summaryrefslogtreecommitdiff
path: root/src/Notepad/Presentation/Presenters/Commands
diff options
context:
space:
mode:
authormo <mo.khan@gmail.com>2018-11-04 15:22:16 -0700
committermo <mo.khan@gmail.com>2018-11-04 15:22:16 -0700
commit5ee1f55497a4e30322a56f133f897ecde1612967 (patch)
treebf544e0879234c3623869627d8786776cb19b8e9 /src/Notepad/Presentation/Presenters/Commands
initial commit.HEADmaster
Diffstat (limited to 'src/Notepad/Presentation/Presenters/Commands')
-rw-r--r--src/Notepad/Presentation/Presenters/Commands/IRunPresenterCommand.cs18
-rw-r--r--src/Notepad/Presentation/Presenters/Commands/RunPresenterCommandSpecs.cs34
2 files changed, 52 insertions, 0 deletions
diff --git a/src/Notepad/Presentation/Presenters/Commands/IRunPresenterCommand.cs b/src/Notepad/Presentation/Presenters/Commands/IRunPresenterCommand.cs
new file mode 100644
index 0000000..9d7458e
--- /dev/null
+++ b/src/Notepad/Presentation/Presenters/Commands/IRunPresenterCommand.cs
@@ -0,0 +1,18 @@
+using Notepad.Infrastructure.Core;
+using Notepad.Presentation.Core;
+
+namespace Notepad.Presentation.Presenters.Commands {
+ public interface IRunPresenterCommand<Presenter> : ICommand where Presenter : IPresenter {}
+
+ public class RunPresenterCommand<Presenter> : IRunPresenterCommand<Presenter> where Presenter : IPresenter {
+ private readonly IApplicationController applicationController;
+
+ public RunPresenterCommand(IApplicationController applicationController) {
+ this.applicationController = applicationController;
+ }
+
+ public void Execute() {
+ applicationController.Run<Presenter>();
+ }
+ }
+} \ No newline at end of file
diff --git a/src/Notepad/Presentation/Presenters/Commands/RunPresenterCommandSpecs.cs b/src/Notepad/Presentation/Presenters/Commands/RunPresenterCommandSpecs.cs
new file mode 100644
index 0000000..5ec7002
--- /dev/null
+++ b/src/Notepad/Presentation/Presenters/Commands/RunPresenterCommandSpecs.cs
@@ -0,0 +1,34 @@
+using MbUnit.Framework;
+using Notepad.Presentation.Core;
+using Rhino.Mocks;
+
+namespace Notepad.Presentation.Presenters.Commands {
+ public class RunPresenterCommandSpecs {}
+
+ [TestFixture]
+ public class when_executing_the_run_presenter_command_ {
+ private MockRepository mockery;
+ private IApplicationController applicationController;
+
+ [SetUp]
+ public void SetUp() {
+ mockery = new MockRepository();
+ applicationController = mockery.DynamicMock<IApplicationController>();
+ }
+
+ [Test]
+ public void should_run_the_display_about_presenter() {
+ using (mockery.Record()) {
+ applicationController.Run<IPresenter>();
+ }
+
+ using (mockery.Playback()) {
+ CreateSUT().Execute();
+ }
+ }
+
+ private IRunPresenterCommand<IPresenter> CreateSUT() {
+ return new RunPresenterCommand<IPresenter>(applicationController);
+ }
+ }
+} \ No newline at end of file