Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Resulting in rock->paper and paper->scissor

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();
        }