main
 1using System;
 2using developwithpassion.bdd.contexts;
 3using Gorilla.Commons.Testing;
 4using MoMoney.Presentation.Model.Menu.File;
 5using MoMoney.Presentation.Winforms.Helpers;
 6
 7namespace MoMoney.Presentation.Winforms.Views
 8{
 9    [Concern(typeof(SaveChangesView))]
10    [Integration]
11    public class when_prompted_to_save_changes_to_the_project : concerns_for<SaveChangesView>
12    {
13        context c = () => { presenter = an<ISaveChangesPresenter>(); };
14
15        after_the_sut_has_been_created after = () =>
16                                                   {
17                                                       save_changes_window = sut;
18                                                       save_changes_window.attach_to(presenter);
19                                                   };
20
21        protected static ISaveChangesPresenter presenter;
22        protected static SaveChangesView save_changes_window;
23    }
24
25    public class when_the_save_button_is_pressed : when_prompted_to_save_changes_to_the_project
26    {
27        it should_save_the_current_project = () => presenter.was_told_to(x => x.save());
28
29        because b = () => save_changes_window.save_button.control_is(x => x.OnClick(new EventArgs()));
30    }
31
32    public class when_the_cancel_button_is_pressed : when_prompted_to_save_changes_to_the_project
33    {
34        it should_not_continue_processing_the_previous_action = () => presenter.was_told_to(x => x.cancel());
35
36        because b = () => save_changes_window.cancel_button.control_is(x => x.OnClick(new EventArgs()));
37    }
38
39    public class when_the_do_not_save_button_is_pressed : when_prompted_to_save_changes_to_the_project
40    {
41        it should_not_save_the_project = () => presenter.was_told_to(x => x.dont_save());
42
43        because b = () => save_changes_window.do_not_save_button.control_is(x => x.OnClick(new EventArgs()));
44    }
45}