blob: 651886b02e1555eeadc69f15e79698e726e58562 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
|
using developwithpassion.bdd.contexts;
using Gorilla.Commons.Testing;
using Gorilla.Commons.Utility;
using Gorilla.Commons.Utility.Core;
using MoMoney.DTO;
using MoMoney.Presentation.Presenters.Commands;
using MoMoney.Presentation.Views.updates;
using MoMoney.Service.Contracts.Infrastructure.Updating;
using MoMoney.Service.Infrastructure.Updating;
using MoMoney.Tasks.infrastructure.updating;
namespace MoMoney.Presentation.Presenters.updates
{
[Concern(typeof (CheckForUpdatesPresenter))]
public abstract class behaves_like_check_for_updates_presenter :
concerns_for<ICheckForUpdatesPresenter, CheckForUpdatesPresenter>
{
context c = () =>
{
view = the_dependency<ICheckForUpdatesView>();
pump = the_dependency<ICommandPump>();
};
static protected ICheckForUpdatesView view;
static protected ICommandPump pump;
}
public class when_attempting_to_check_for_updates : behaves_like_check_for_updates_presenter
{
it should_tell_the_view_to_attach_itself_to_the_presenter = () => view.was_told_to(x => x.attach_to(sut));
it should_tell_the_view_to_display_the_information_on_the_current_version_of_the_application =
() => view.was_told_to(x => x.display());
it should_go_and_find_out_what_the_latest_version_is =
() => pump.was_told_to(x => x.run<ApplicationVersion, IWhatIsTheAvailableVersion>(view));
because b = () => sut.run();
}
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 =
() => pump.was_told_to(x => x.run<IDownloadTheLatestVersion, ICallback<Percent>>(sut));
because b = () => sut.begin_update();
}
public class when_downloading_an_update : behaves_like_check_for_updates_presenter
{
it should_notify_you_of_the_progress_of_the_update = () => view.was_told_to(x => x.downloaded(50));
because b = () => sut.run(50);
}
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.run(100);
}
public class when_an_update_is_cancelled : behaves_like_check_for_updates_presenter
{
it should_stop_downloading_the_latest_update = () => pump.was_told_to(x => x.run<ICancelUpdate>());
because b = () => sut.cancel_update();
}
public class when_an_update_is_complete_and_the_user_agrees_to_restart_the_application :
behaves_like_check_for_updates_presenter
{
it should_restart_the_application = () => pump.was_told_to(x => x.run<IRestartCommand>());
because b = () => sut.restart();
}
}
|