chevron-thin-right chevron-thin-left brand cancel-circle search youtube-icon google-plus-icon linkedin-icon facebook-icon twitter-icon toolbox download check linkedin phone twitter-old google-plus facebook profile-male chat calendar profile-male
0 votes
I have read everything that popped up in Google on the forum here for this exception: "Cannot call Isolate.Verify.WasCalledWithArguments without a closing Matching function". However, I think I did everything described in the documentation.
 
The exception is thrown only when I run all of my tests. One by one they are passing. Initially, I forgot to include the Isolated attribute. However, all of my classes have it now. I tried different combinations- I set it on all methods, on all classes, instead of it I called Isolate.CleanUp at the beginning of the test or the end. However, the result is the same from 45 tests always from 3-5 are failing.
 
There are tests that I use Isolate.Verify.WasCalledWithAnyArguments but half of them call simple NUnit Asserts. Almost all of the tests are mocking static methods. I guess it is possible the problem to come from there.
 
 
 
Any help will be much appreciated.  We are still evaluating the framework, and if I cannot execute the most simple our scenarios, I don't see a point to purchase it.
 
Example for one of the failing tests:
[Test]
public void PassSameParametersToSomeMethod_WhenMessageNotNull()
{
    var status = Fixture.Create<int>(); //generates random int
    var message = Fixture.Create<string>();
    var fake = Isolate.Fake.NextInstance<SomeOfMyClasses1>();
 
    SomeOfMyClasses2.InsertIncorrectName(tenant, message); // calls a static method that creates an instance from SomeOfMyClasses1 and calls a method
 
    Isolate.Verify.WasCalledWithArguments(() => fake.SomeMethod(status, message));
}
 
Thanks,
 
Anton
asked by angelovstanton (600 points)

Please log in or register to answer this question.

...