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