Tutorial by Examples

Where a method to be tested uses information from one call to pass on to subsequent calls, one approach that can be used to ensure the methods are called in the expected order is to setup the expectations to reflect this flow of data. Given the method to test: public void MethodToTest() { va...
When you can't / don't want to use Strict Mocks, you can't use MockSequence to validate call order. An alternate approach is to use callbacks to validate that the Setup expectations are being invoked in the expected order. Given the following method to test: public void MethodToTest() { _ut...
Moq provides support for validating call order using MockSequence, however it only works when using Strict mocks. So, Given the following method to test: public void MethodToTest() { _utility.Operation1("1111"); _utility.Operation2("2222"); _utility.Operation3(&...

Page 1 of 1