...
Resulting in rock->paper and paper->scissor
Helping the mock object out of its verified state
Suppose you have the System.InvalidOperationException: This action is invalid when the mock object is in verified state
You can't use a mock in Rhino Mocks after its expectations were verified, even if you're calling a method that does not make part of your expectations.
To solve this use the following:
Code Block |
---|
[TearDown] public void TearDown() { _mocks.BackToRecordAll(); if (_testee != null) _testee.Dispose(); } [Test] public void Test() { // Expectations setup _someInterface.DoStuff(); _mocks.ReplayAll(); // Replay _testee.SomeInterface = _someInterface; _testee.DoSomeOtherStuff(); _mocks.VerifyAll(); } |