Commit b423e28

mo <email@solidware.ca>
2011-04-03 03:09:58
close the add new stock symbol dialog once the add button is pressed.
1 parent 4f4a7a9
Changed files (3)
product
product/desktop.ui/presenters/AddNewStockSymbolPresenter.cs
@@ -16,7 +16,7 @@ namespace solidware.financials.windows.ui.presenters
         public ObservableCommand Add { get; set; }
         public ObservableCommand Cancel { get; set; }
         public virtual string Symbol { get; set; }
-        public Action close { get; set; }
+        public virtual Action close { get; set; }
 
         public void present()
         {
@@ -36,6 +36,7 @@ namespace solidware.financials.windows.ui.presenters
             public override void run(AddNewStockSymbolPresenter presenter)
             {
                 bus.publish(new StartWatchingSymbol {Symbol = presenter.Symbol});
+                presenter.close();
             }
         }
     }
product/desktop.ui/views/dialogs/AddNewStockSymbolDialog.xaml
@@ -1,4 +1,4 @@
-<ui:WPFDialog x:Class="solidware.financials.windows.ui.views.dialogs.AddNewStockSymbolDialog" xmlns:ui="clr-namespace:solidware.financials.windows.ui" x:TypeArguments="presenters:AddNewStockSymbolPresenter" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:presenters="clr-namespace:solidware.financials.windows.ui.presenters" Title="AddNewStockSymbolDialog" Height="300" Width="300">
+<ui:WPFDialog x:Class="solidware.financials.windows.ui.views.dialogs.AddNewStockSymbolDialog" xmlns:ui="clr-namespace:solidware.financials.windows.ui" x:TypeArguments="presenters:AddNewStockSymbolPresenter" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:presenters="clr-namespace:solidware.financials.windows.ui.presenters" Title="Watch New Stock" Width="400" Height="90" WindowStartupLocation="CenterOwner">
     <StackPanel>
         <DockPanel>
             <Label Width="120px">Symbol:</Label>
product/specs/unit/ui/presenters/AddNewStockSymbolPresenterSpecs.cs
@@ -1,4 +1,5 @@
 using Machine.Specifications;
+using Rhino.Mocks;
 using solidware.financials.infrastructure;
 using solidware.financials.messages;
 using solidware.financials.windows.ui;
@@ -69,6 +70,7 @@ namespace specs.unit.ui.presenters
                 {
                     presenter = Create.an<AddNewStockSymbolPresenter>();
                     presenter.is_told_to(x => x.Symbol).it_will_return("TD.TO");
+                    presenter.Stub(x => x.close).Return(() => { closed = true; });
                 };
 
                 Because of = () =>
@@ -81,7 +83,13 @@ namespace specs.unit.ui.presenters
                     bus.received(x => x.publish(new StartWatchingSymbol {Symbol = "TD.TO"}));
                 };
 
+                It should_close_the_dialog = () =>
+                {
+                    closed.should_be_true();
+                };
+
                 static AddNewStockSymbolPresenter presenter;
+                static bool closed;
             }
         }
     }