main
 1using developwithpassion.bdd.contexts;
 2using Gorilla.Commons.Testing;
 3using MoMoney.Presentation.Model.Menu.File;
 4using MoMoney.Presentation.Model.Projects;
 5
 6namespace momoney.presentation.model.menu.file
 7{
 8    [Concern(typeof (NewCommand))]
 9    public abstract class behaves_like_new_command : concerns_for<INewCommand, NewCommand>
10    {
11        context c = () =>
12        {
13            current_project = the_dependency<IProjectController>();
14            save_changes_command = the_dependency<ISaveChangesCommand>();
15        };
16
17        protected static IProjectController current_project;
18        protected static ISaveChangesCommand save_changes_command;
19    }
20
21    public class before_starting_a_new_project : behaves_like_new_command
22    {
23        it should_check_to_see_if_there_were_any_unsaved_changes_to_a_previous_project =
24            () => save_changes_command.was_told_to(x => x.run(sut));
25
26        because b = () => sut.run();
27    }
28
29    public class when_starting_a_new_project_after_saving_a_previous_one : behaves_like_new_command
30    {
31        it should_start_a_new_project = () => current_project.was_told_to(x => x.start_new_project());
32
33        because b = () => sut.saved();
34    }
35
36    public class when_starting_a_new_project_after_declining_to_save_a_previous_one : behaves_like_new_command
37    {
38        it should_start_a_new_project = () => current_project.was_told_to(x => x.start_new_project());
39
40        because b = () => sut.not_saved();
41    }
42
43    public class when_starting_a_new_project_and_cancelling_when_asked_to_save_the_changes_to_a_previous_project :
44        behaves_like_new_command
45    {
46        it should_not_start_a_new_project =
47            () => current_project.was_not_told_to(x => x.start_new_project());
48
49        because b = () => sut.cancelled();
50    }
51}