I have a unit test where I use .Returns() to return some sample data:
[TestMethod]
public void TestRetrieveElementsInVersion()
{
IRetriev
In my case, it was a Received() call on exension method (likely because it's not virtual). So I went back to my pull request and removed every instance of it and it worked.
This is most like due to a previous test using an argument matcher against a non-virtual method, or in a Returns
statement.
Unfortunately this can be quite tricky to debug. First step is to see if the problem occurs when you run all the test in this fixture. If so, check all uses of Arg.Is|Any
in that fixture, starting with the one that runs immediately before the test that fails (if your test framework uses a predictable test order, otherwise you'll need to look at test logs to see what tests proceed the failing one).
If it does not occur with that fixture you'll need to look through the fixtures that run beforehand to see where the left over arg matcher is coming from. It is most likely somewhere near the failing test.