Rhino.Mocks allows multiple stubs to be set up on the same method (so you can test what would happen if the first call returns true and the second call returns false).
If you want to "reset" and clear out all previous stubs, you could: status.GetMockRepository().BackToRecordAll(); status.GetMockRepository().ReplayAll(); That should reset everything (i.e. whatever stubs you've previously set up should be cleared). --- Patrick Steele http://weblogs.asp.net/psteele On Mon, Sep 24, 2012 at 2:16 PM, Jeffrey Bridgman <[email protected]> wrote: > The stripped down example is a bit contrived, but is there any reason I > can't stub a property twice and the "last one wins"? > Turning IStatus.Connected into a function produces the same result. VB.Net > has the same result. Tested using Rhino Mock 3.6 build 21. > > [TestFixture()] > public class TestTests > { > private IStatus _status; > > [SetUp()] > public void Setup() > { > this._status = MockRepository.GenerateStub<IStatus>(); > this._status.Stub(x => x.Connected()).Return(true); > // This second stub might lie in a subclass if you're reducing setup > code duplication using inheritance > this._status.Stub(x => x.Connected()).Return(false); > } > > [Test()] > public void TestTheTestFramework() > { > Assert.IsFalse(this._status.Connected()); // Fails ... > } > } > > -- > You received this message because you are subscribed to the Google Groups > "Rhino.Mocks" group. > To view this discussion on the web visit > https://groups.google.com/d/msg/rhinomocks/-/VeSM6LXIf_MJ. > 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. -- 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.
