main
 1using Gorilla.Commons.Infrastructure.Container;
 2using Machine.Specifications;
 3using presentation.windows;
 4using presentation.windows.presenters;
 5
 6namespace unit.client.presenters
 7{
 8    [Subject(typeof (WPFCommandBuilder))]
 9    public class WPFCommandBuilderSpecs
10    {
11        public class concern : Helpers
12        {
13            Establish context = () =>
14            {
15                container = a<DependencyRegistry>();
16                sut = new WPFCommandBuilder(container);
17            };
18
19            static protected WPFCommandBuilder sut;
20            static protected DependencyRegistry container;
21        }
22
23        public class when_building_a_command_to_bind_to_a_presenter : concern
24        {
25            It should_return_a_command_that_executes_the_command_when_run = () =>
26            {
27                command.received(x => x.run(presenter));
28            };
29
30            Establish context = () =>
31            {
32                presenter = a<Presenter>();
33                command = a<UICommand>();
34                container.is_told_to(x => x.get_a<UICommand>()).it_will_return(command);
35            };
36
37            Because b = () =>
38            {
39                sut.build<UICommand>(presenter).Execute(null);
40            };
41
42            static Presenter presenter;
43            static UICommand command;
44        }
45    }
46}