KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
Can I change the behaviour of a stub during runtime? Something like: public interface IFoo { string GetBar(); } [TestMethod] public void TestRhino() { var fi = MockRepository.GenerateStub<IFoo>(); fi.Stub(x => x.GetBar()).Return("A"); Assert.AreEqual("A", fi.GetBar()); fi.Stub(x => x.GetBar()).Return("B"); Assert.AreEqual("B", fi.GetBar()); // Currently fails here } My code example still fails in the given line, fi.GetBar() still returns "A" . Or is there another trick to model stubs whose behaviour changes over time? I'd rather not resort to using fi.Stub(...).Do(...) . Ah, probably I just need hardcopy of the fine manual for somebody to hit me over the head with it. It looks like it should really be obvious, but I can't find it.
Tags (comma-separated)
Save Edits
Cancel