Commit c4f5c2e

mokhan <mokhan@ce5e1baf-6525-42e4-a1b2-857ea38da20a>
2009-03-06 16:58:07
testing the save changes view.
git-svn-id: https://svn.xp-dev.com/svn/mokhan-mo.money@55 ce5e1baf-6525-42e4-a1b2-857ea38da20a
1 parent a20e13b
Changed files (4)
trunk
product
trunk/product/MyMoney/Presentation/Views/dialogs/SaveChangesView.Designer.cs
@@ -135,9 +135,9 @@ public    partial class SaveChangesView
         #endregion
 
     public System.Windows.Forms.Button ux_save_button;
-        private System.Windows.Forms.Button ux_do_not_save_button;
-        private System.Windows.Forms.Button ux_cancel_button;
-        private System.Windows.Forms.PictureBox ux_image;
+        public System.Windows.Forms.Button ux_do_not_save_button;
+        public System.Windows.Forms.Button ux_cancel_button;
+        public System.Windows.Forms.PictureBox ux_image;
         private System.Windows.Forms.Label label1;
         private System.Windows.Forms.Label label2;
         private System.Windows.Forms.Label label3;
trunk/product/MyMoney/Presentation/Views/dialogs/SaveChangesViewSpecs.cs
@@ -0,0 +1,44 @@
+using System;
+using jpboodhoo.bdd.contexts;
+using MoMoney.Presentation.Model.Menu.File.Commands;
+using MoMoney.Testing.spechelpers.contexts;
+using MoMoney.Testing.spechelpers.core;
+using MoMoney.Testing.win.forms;
+
+namespace MoMoney.Presentation.Views.dialogs
+{
+    public class behaves_like_save_changes_view_bound_to_presenter : concerns_for<SaveChangesView>
+    {
+        context c = () => { presenter = an<ISaveChangesPresenter>(); };
+
+        because b = () => sut.attach_to(presenter);
+
+        static protected ISaveChangesPresenter presenter;
+    }
+
+    public class when_the_save_button_is_clicked : behaves_like_save_changes_view_bound_to_presenter
+    {
+        it should_forward_the_call_to_the_presenter = () => presenter.was_told_to(x => x.save());
+
+        because b =
+            () => EventTrigger.trigger_event<Events.ControlEvents>(x => x.OnClick(new EventArgs()), sut.ux_save_button);
+    }
+
+    public class when_the_cancel_button_is_clicked : behaves_like_save_changes_view_bound_to_presenter
+    {
+        it should_forward_the_call_to_the_presenter = () => presenter.was_told_to(x => x.cancel());
+
+        because b =
+            () =>
+            EventTrigger.trigger_event<Events.ControlEvents>(x => x.OnClick(new EventArgs()), sut.ux_cancel_button);
+    }
+
+    public class when_the_do_not_save_button_is_clicked : behaves_like_save_changes_view_bound_to_presenter
+    {
+        it should_forward_the_call_to_the_presenter = () => presenter.was_told_to(x => x.dont_save());
+
+        because b =
+            () =>
+            EventTrigger.trigger_event<Events.ControlEvents>(x => x.OnClick(new EventArgs()), sut.ux_do_not_save_button);
+    }
+}
\ No newline at end of file
trunk/product/MyMoney/Testing/win.forms/Events.cs
@@ -1,4 +1,5 @@
 using System;
+using System.ComponentModel;
 using System.Windows.Forms;
 
 namespace MoMoney.Testing.win.forms
@@ -8,7 +9,23 @@ namespace MoMoney.Testing.win.forms
         public interface ControlEvents : IEventTarget
         {
             void OnEnter(EventArgs args);
+
             void OnKeyPress(KeyPressEventArgs args);
+            void OnKeyUp(KeyEventArgs args);
+            void OnKeyDown(KeyEventArgs args);
+
+            void OnClick(EventArgs args);
+            void OnDoubleClick(EventArgs args);
+            void OnDragDrop(DragEventArgs args);
+            void OnDragEnter(DragEventArgs args);
+            void OnDragLeave(EventArgs args);
+            void OnDragOver(DragEventArgs args);
+
+            void OnMouseWheel(MouseEventArgs args);
+
+            void OnValidated(EventArgs args);
+            void OnValidating(CancelEventArgs args);
+
         }
 
         public interface FormEvents : ControlEvents
trunk/product/MyMoney/MyMoney.csproj
@@ -393,6 +393,7 @@
     <Compile Include="Presentation\Views\dialogs\SaveChangesView.Designer.cs">
       <DependentUpon>SaveChangesView.cs</DependentUpon>
     </Compile>
+    <Compile Include="Presentation\Views\dialogs\SaveChangesViewSpecs.cs" />
     <Compile Include="Presentation\Views\IAddCompanyView.cs" />
     <Compile Include="Presentation\Views\billing\IViewAllBills.cs" />
     <Compile Include="Presentation\Views\billing\view_all_bills.cs">