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].
For more options, visit this group at
http://groups.google.com/group/rhinomocks?hl=en.