unit testing - Moq: how to assert that methods on my mock object are NOT run? -


I'm copied to work, where I test that the methods of my malled object Are called together, and return the right results.

Now I want to check another condition in this case, any method should be run on the mall object. How can I express it in a unit test?

You can create your counterfeit as hard as you can only set up the methods Or expectation, depending on the version of the game you are playing with).

  var foo = new mock & lt; IFoo & gt; (Fake carrier strict); Foo.Expect (f => f.Bar ()); At any time, a method is called on foo in addition to the bar (), an exception will be raised and your test will fail. 


Comments