public
static
class
FooExtensions
{
public
static
string
Echo(
this
Foo foo,
string
value)
{
return
value;
}
}
...
[TestMethod]
public
void
ShouldAssertExtensionMethodMockingWithArguments()
{
string
expected =
"bar"
;
// ARRANGE
var foo =
new
Foo();
// Arranging: When the extension method foo.Echo() is called with any string argument,
// it should return expected.
Mock.Arrange(() => foo.Echo(Arg.IsAny<
string
>())).Returns(expected);
// ACT
string
actual = foo.Echo(
"hello"
);
// ASSERT
Assert.AreEqual(expected, actual);
}