+1 for using the ObsoleteAttribute :) I find them hard to read/follow/understand/use.
On Mon, Mar 1, 2010 at 3:18 PM, bill richards <[email protected]>wrote: > The main difference is that the second version of your test is the > preferred method ... the first uses Record/Replay syntax and can be > somewhat confusing for some (most) users ... I really think that these > members ought to be marked as deprecated in the next release. > > That's my two-cents' worth > > On Mar 1, 8:33 pm, Adam <[email protected]> wrote: > > Sorry for such a basic post, but is there any real difference between > > the two unit tests below? (the content is meaningless - just wanted > > some interfaces to interact with each other). It seems like the > > second one is much cleaner, but I'm not sure if I'm missing something. > > > > Thanks! > > > > [TestMethod] > > public void Test1() { > > var mocks = new MockRepository(); > > IStaleDataChecker sc = > > mocks.StrictMock<IStaleDataChecker>(); > > IDAO dao = mocks.StrictMock<IDAO>(); > > IItem item = mocks.StrictMock<IItem>(); > > > > using (mocks.Record()) { > > SetupResult.For(sc.IsGood(item)).Return(true); > > > > dao.Save(item); > > LastCall.Repeat.Once(); > > } > > > > using (mocks.Playback()) { > > Presenter P = new Presenter(sc, dao); > > P.Run(item); > > } > > } > > > > [TestMethod] > > public void Test2() { > > IStaleDataChecker sc = > > MockRepository.GenerateMock<IStaleDataChecker>(); > > IDAO dao = MockRepository.GenerateMock<IDAO>(); > > IItem item = MockRepository.GenerateMock<IItem>(); > > > > sc.Expect(S => S.IsGood(item)).Return(true); > > > > Presenter P = new Presenter(sc, dao); > > P.Run(item); > > > > dao.AssertWasCalled(d => d.Save(item)); > > } > > -- > 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]<rhinomocks%[email protected]> > . > For more options, visit this group at > http://groups.google.com/group/rhinomocks?hl=en. > > -- Chris Missal http://chrismissal.lostechies.com/ -- 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.
