main
1using System;
2using developwithpassion.bdd.contexts;
3using Gorilla.Commons.Testing;
4using momoney.presentation.model.eventing;
5using momoney.presentation.views;
6using MoMoney.Service.Infrastructure.Eventing;
7
8namespace momoney.presentation.presenters
9{
10 public class behaves_like_unhandled_error_presenter :
11 concerns_for<IUnhandledErrorPresenter, UnhandledErrorPresenter>
12 {
13 //public override IUnhandledErrorPresenter create_sut()
14 //{
15 // return new UnhandledErrorPresenter(view, broker);
16 //}
17
18 context c = () =>
19 {
20 view = the_dependency<IUnhandledErrorView>();
21 broker = the_dependency<IEventAggregator>();
22 };
23
24 protected static IUnhandledErrorView view;
25 protected static IEventAggregator broker;
26 }
27
28 public class when_the_presenter_is_run : behaves_like_unhandled_error_presenter
29 {
30 it should_listen_for_any_errors_in_the_application = () => broker.was_told_to(x => x.subscribe_to(sut));
31
32 because b = () => sut.run();
33 }
34
35 public class when_an_error_occurs_in_the_application : behaves_like_unhandled_error_presenter
36 {
37 it should_display_the_error = () => view.was_told_to(x => x.display(error));
38
39 because b = () => sut.notify(new UnhandledErrorOccurred(error));
40
41 static readonly Exception error = new Exception();
42 }
43}