I am seeing some unexpected behavior with VerifyAllExpectations and
wanted to understand it better.  Here is a minimal repro of the
behavior:

        [Test]
        public void VerifyAllExpectations()
        {
            var obj =
MockRepository.GenerateStrictMock<IDisposable>();

            try
            {
                obj.Dispose();
            }
            catch (Exception)
            {
                // Will catch here - obj.Dispose() was unexpected
            }

            // Now I expect dispose to be called ...
            obj.Expect(o => o.Dispose());
            // ... and dispose is called.
            obj.Dispose();

            // Since an expectation was violated during this test,
shouldn't this throw?
            obj.VerifyAllExpectations();
        }

I would expect this test to fail, as I was expecting
VerifyAllExpectations to throw at the end, but this test passes in the
version of RhinoMocks I am using (3.6).  I can work around this by
calling obj.AssertWasNotCalled right after the catch but would prefer
not to do that if possible.  In my code I call VerifyAllExpectations
in the TearDown and want that to catch any unintentional calls to an
object.  I am intentionally using a strict mock here as I want to
carefully control when calls to a particular interface are made.

Thanks,

Dylan

-- 
You received this message because you are subscribed to the Google Groups 
"Rhino.Mocks" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rhinomocks?hl=en.

Reply via email to