I have test method and it fails on calling mocked method.
The mocked interface:
public interface IRepository
{
Documents GetDocuments(
int projectPK,
int? folderPK,
bool useFolders,
string search,
int user,
int page,
int pageSize,
string customerConnectionString);
}
And this is the setup and call of mocked method:
Mock<IRepository> repositoryMock;
repositoryMock
.Setup(
c => c.GetDocuments(
It.IsAny<int>(),
It.IsAny<int?>(),
It.IsAny<bool>(),
It.IsAny<string>(),
It.IsAny<int>(),
It.IsAny<int>(),
It.IsAny<int>(),
It.IsAny<string>()
)
)
.Returns(new Documents());
After setting strict mode I've found out the source problem is not called and if I try to verify the call like this:
repositoryMock.Verify(
r => r.GetDocuments(1, 1, true, "", 1 ,1 ,1 , ""));
I get Moq.MockException: Expected invocation on the mock at least once, but was never performed: r => r.GetDocuments(1, (Nullable'1)1, True, "", 1, 1, 1, "")
Does anyone see any mistake I could have made?
Aucun commentaire:
Enregistrer un commentaire