|
From: Mike M. <mg...@es...> - 2007-09-12 14:59:30
|
Oops. Apparently tab-enter sends emails. What I meant was
[Test]
PresenterSetsMessage {
Expect.Once.On(view).SetProperty("Message").To("Order saved");
StubStuffOnView();
presenter.DoSomething();
}
void StubStuffOnView() {
Stub.On(view).SetProperty("Message");
Stub.On(view).GetProperty("someProp");
Stub.On(view).GetProperty("somethingElse");
}
Because a stub that isn't called won't fail your test, this kind of
arrangement works. If you don't do this, all your presenter tests will need
to expect or stub a whole different range of stuff and become quickly
unreadable.
Personally I've mostly stopped testing presenters -- tests thats essentially
say "presenter should copy data from view to business logic method" aren't
that useful, and my presenters tend to be pretty small.
Hope this helps.
Mike.
On 9/12/07, Mike Mason <mg...@es...> wrote:
>
> Also in NMock, you can set up your expectations first and then stub
> everything afterwards. So something like
>
> [Test]
> PresenterShouldSetImportantMessageOnView() {
>
>
|