In many situations, especially in complex projects with numerous features interacting with each other, a method can be called too many or too few times, resulting in unexpected behavior of the software. To verify that the method in question is called the exact number of times, additional code is typically written and maintained to handle that verification.
JustMock allows you simple and fast assertion of how many times the method is called without the cost of developing and maintaining additional code.
Set Assertion Expectation During Arrange
One of the possible options when verifying the occurrence of a method call is to set the expectation at the arrange phase and verify all assertion expectation for the mock object at the end of the test.
Order order = Mock.Create<Order>(Behavior.CallOriginal);