Commit d7c3168
Changed files (6)
trunk
src
MyMoney
Presentation
Presenters
Views
updates
Tasks
infrastructure
Utility
Core
trunk/src/MyMoney/Presentation/Presenters/updates/CheckForUpdatesPresenter.cs
@@ -1,11 +1,13 @@
using MyMoney.Presentation.Core;
using MyMoney.Presentation.Views.updates;
using MyMoney.Tasks.infrastructure;
+using MyMoney.Utility.Core;
namespace MyMoney.Presentation.Presenters.updates
{
- public interface ICheckForUpdatesPresenter : IPresenter
+ public interface ICheckForUpdatesPresenter : IPresenter, ICallback
{
+ void begin_update();
}
public class CheckForUpdatesPresenter : ICheckForUpdatesPresenter
@@ -24,5 +26,15 @@ namespace MyMoney.Presentation.Presenters.updates
view.attach_to(this);
view.display(tasks.current_application_version());
}
+
+ public void begin_update()
+ {
+ tasks.grab_the_latest_version(this);
+ }
+
+ public void complete()
+ {
+ view.update_complete();
+ }
}
}
\ No newline at end of file
trunk/src/MyMoney/Presentation/Presenters/updates/CheckForUpdatesPresenterSpecs.cs
@@ -2,13 +2,14 @@ using jpboodhoo.bdd.contexts;
using MyMoney.Presentation.Model.updates;
using MyMoney.Presentation.Views.updates;
using MyMoney.Tasks.infrastructure;
+using MyMoney.Testing.MetaData;
using MyMoney.Testing.spechelpers.contexts;
using MyMoney.Testing.spechelpers.core;
namespace MyMoney.Presentation.Presenters.updates
{
- public class behaves_like_check_for_updates_presenter :
- concerns_for<ICheckForUpdatesPresenter, CheckForUpdatesPresenter>
+ [Concern(typeof (CheckForUpdatesPresenter))]
+ public class behaves_like_check_for_updates_presenter : concerns_for<ICheckForUpdatesPresenter, CheckForUpdatesPresenter>
{
public override ICheckForUpdatesPresenter create_sut()
{
@@ -42,4 +43,19 @@ namespace MyMoney.Presentation.Presenters.updates
static ApplicationVersion version;
}
+
+ public class when_initiating_an_update_and_one_is_available : behaves_like_check_for_updates_presenter
+ {
+ it should_start_downloading_the_latest_version_of_the_application =
+ () => tasks.was_told_to(x => x.grab_the_latest_version(sut));
+
+ because b = () => sut.begin_update();
+ }
+
+ public class when_an_update_is_completed : behaves_like_check_for_updates_presenter
+ {
+ it should_notify_the_view_that_the_update_is_complete = () => view.was_told_to(x => x.update_complete());
+
+ because b = () => sut.complete();
+ }
}
\ No newline at end of file
trunk/src/MyMoney/Presentation/Views/updates/ICheckForUpdatesView.cs
@@ -7,5 +7,6 @@ namespace MyMoney.Presentation.Views.updates
public interface ICheckForUpdatesView : IView<ICheckForUpdatesPresenter>
{
void display(ApplicationVersion information);
+ void update_complete();
}
}
\ No newline at end of file
trunk/src/MyMoney/Tasks/infrastructure/IUpdateTasks.cs
@@ -1,9 +1,11 @@
using MyMoney.Presentation.Model.updates;
+using MyMoney.Utility.Core;
namespace MyMoney.Tasks.infrastructure
{
public interface IUpdateTasks
{
ApplicationVersion current_application_version();
+ void grab_the_latest_version(ICallback callback);
}
}
\ No newline at end of file
trunk/src/MyMoney/Utility/Core/ICallback.cs
@@ -0,0 +1,7 @@
+namespace MyMoney.Utility.Core
+{
+ public interface ICallback
+ {
+ void complete();
+ }
+}
\ No newline at end of file
trunk/src/MyMoney/MyMoney.csproj
@@ -422,6 +422,7 @@
<Compile Include="Utility\Core\command.cs" />
<Compile Include="Utility\Core\empty_command.cs" />
<Compile Include="Utility\Core\IBuilder.cs" />
+ <Compile Include="Utility\Core\ICallback.cs" />
<Compile Include="Utility\Core\IDisposableCommand.cs" />
<Compile Include="Utility\Core\IFactory.cs" />
<Compile Include="Utility\Core\IParameterizedCommand.cs" />