Search code examples
unit-testingrhino-mocks

Rhino Mocks: "Verify" vs. "Assert"


When using Rhino Mocks, when is it appropriate to use "VerifyAll" and when should I do "Asserts"?


Solution

  • VerifyAll and Verify are used to check that some methods have been called (and possibly verify the parameters with which they were called). This is considered "interaction-based testing", and is used when you want to verify that the system-under-test calls a method on one of its dependencies.

    Asserts normally means that you want to make sure the value returned has the correct value. Asserts are used for what is called "state-based testing", which is essentially verifying the state of the system-under-test after it has been acted upon.

    verifyall, check out this.

    Also, differentiate Mock and Stub .