main
 1using developwithpassion.bdd.contexts;
 2using Gorilla.Commons.Testing;
 3using MoMoney.DTO;
 4using MoMoney.Presentation.Views;
 5using MoMoney.Service.Contracts.Application;
 6
 7namespace MoMoney.Presentation.Presenters
 8{
 9    [Concern(typeof (AddCompanyPresenter))]
10    public abstract class behaves_like_the_add_company_presenter :
11        concerns_for<IAddCompanyPresenter, AddCompanyPresenter>
12    {
13        context c = () =>
14                        {
15                            view = the_dependency<IAddCompanyView>();
16                            pump = the_dependency<ICommandPump>();
17                        };
18
19        static protected IAddCompanyView view;
20        static protected ICommandPump pump;
21    }
22
23    public class when_the_user_is_about_to_add_an_expense : behaves_like_the_add_company_presenter
24    {
25        it should_display_the_correct_screen = () => view.was_told_to(x => x.attach_to(sut));
26
27        because b = () => sut.run();
28    }
29
30    [Concern(typeof (AddCompanyPresenter))]
31    public class when_registering_a_new_company : behaves_like_the_add_company_presenter
32    {
33        context c = () =>
34                        {
35                            dto = new RegisterNewCompany {company_name = "Microsoft"};
36                            when_the(pump)
37                                .is_told_to(x => x.run<IRegisterNewCompanyCommand, RegisterNewCompany>(dto))
38                                .it_will_return(pump);
39                        };
40
41        because b = () => sut.submit(dto);
42
43        it should_add_the_new_company =
44            () => pump.was_told_to(x => x.run<IRegisterNewCompanyCommand, RegisterNewCompany>(dto));
45
46        static RegisterNewCompany dto;
47    }
48}