I have an interface with a method as follows:
public interface IRepo
{
IA Reserve();
}
I would like to mock the clas
In Moq 4.13 they introduced the It.IsAnyType type which you can using to mock generic methods. E.g.
public interface IFoo
{
bool M1();
bool M2(T arg);
}
var mock = new Mock();
// matches any type argument:
mock.Setup(m => m.M1()).Returns(true);
// matches only type arguments that are subtypes of / implement T:
mock.Setup(m => m.M1>()).Returns(true);
// use of type matchers is allowed in the argument list:
mock.Setup(m => m.M2(It.IsAny())).Returns(true);
mock.Setup(m => m.M2(It.IsAny>())).Returns(true);