main
1using developwithpassion.bdd.contexts;
2using Gorilla.Commons.Testing;
3using momoney.presentation.views;
4using MoMoney.Presentation.Views;
5
6namespace MoMoney.Presentation.Core
7{
8 [Concern(typeof (ApplicationController))]
9 public abstract class behaves_like_an_application_controller :
10 concerns_for<IApplicationController, ApplicationController>
11 {
12 context c = () =>
13 {
14 presenter_registry = the_dependency<IPresenterRegistry>();
15 shell = the_dependency<IShell>();
16 };
17
18 static protected IShell shell;
19 static protected IPresenterRegistry presenter_registry;
20 }
21
22 public class when_the_application_controller_is_asked_to_run_a_presenter : behaves_like_an_application_controller
23 {
24 context c = () =>
25 {
26 implementation_of_the_presenter = an<IPresenter>();
27 presenter_registry
28 .is_told_to(r => r.all())
29 .it_will_return(implementation_of_the_presenter);
30 };
31
32 because b = () => sut.run<IPresenter>();
33
34 it should_ask_the_registered_presenters_for_an_instance_of_the_presenter_to_run =
35 () => presenter_registry.was_told_to(r => r.all());
36
37 it should_initialize_the_presenter_to_run = () => implementation_of_the_presenter.was_told_to(p => p.run());
38
39 static IPresenter implementation_of_the_presenter;
40 }
41
42 public class when_initializing_a_presenter_for_that_presents_a_content_view : behaves_like_an_application_controller
43 {
44 it should_add_the_content_view_to_the_window_shell = () => shell.was_told_to(x => x.add(view));
45
46 context c = () =>
47 {
48 view = an<IDockedContentView>();
49 var presenter = an<IContentPresenter>();
50
51 presenter_registry.is_told_to(r => r.all()).it_will_return(presenter);
52 presenter.is_told_to(x => x.View).it_will_return(view);
53 };
54
55 because b = () => sut.run<IContentPresenter>();
56
57 static IDockedContentView view;
58 }
59}