Commit 3691118

mo_khan <mo@mokhan.ca>
2009-05-25 03:28:26
renamed command pump to event processor
1 parent 55e4ddc
product/project/presentation/infrastructure/CommandPump.cs
@@ -1,9 +0,0 @@
-using mars.rover.common;
-
-namespace mars.rover.presentation.infrastructure
-{
-    public interface CommandPump : Command
-    {
-        void run<Command, Input>(Input input) where Command : ParameterizedCommand<Input>;
-    }
-}
\ No newline at end of file
product/project/presentation/infrastructure/EventProcessor.cs
@@ -0,0 +1,9 @@
+using mars.rover.common;
+
+namespace mars.rover.presentation.infrastructure
+{
+    public interface EventProcessor : Command
+    {
+        void process<Command, Input>(Input input) where Command : ParameterizedCommand<Input>;
+    }
+}
\ No newline at end of file
product/project/presentation/infrastructure/SynchronousCommandPump.cs
@@ -3,7 +3,7 @@ using mars.rover.common;
 
 namespace mars.rover.presentation.infrastructure
 {
-    public class SynchronousCommandPump : CommandPump
+    public class SynchronousCommandPump : EventProcessor
     {
         readonly Registry<ParameterizedCommand<string>> commands;
         readonly CommandProcessor processor;
@@ -17,7 +17,7 @@ namespace mars.rover.presentation.infrastructure
             this.factory = factory;
         }
 
-        public virtual void run<Command, Input>(Input input) where Command : ParameterizedCommand<Input>
+        public virtual void process<Command, Input>(Input input) where Command : ParameterizedCommand<Input>
         {
             processor.add(factory.create_for(() => get<Command, Input>().run_against(input)));
         }
product/project/presentation/CaptureUserInstructionsPresenter.cs
@@ -6,9 +6,9 @@ namespace mars.rover.presentation
     public class CaptureUserInstructionsPresenter : Presenter
     {
         readonly CaptureUserInstructionsView view;
-        readonly CommandPump pump;
+        readonly EventProcessor pump;
 
-        public CaptureUserInstructionsPresenter(CaptureUserInstructionsView view, CommandPump pump)
+        public CaptureUserInstructionsPresenter(CaptureUserInstructionsView view, EventProcessor pump)
         {
             this.view = view;
             this.pump = pump;
@@ -21,17 +21,17 @@ namespace mars.rover.presentation
 
         public virtual void provide_upper_right_coordinates(string line)
         {
-            pump.run<CreateMarsCommand, string>(line);
+            pump.process<CreateMarsCommand, string>(line);
         }
 
         public virtual void deploy_rover_to(string deployment_coordinates)
         {
-            pump.run<DeployRoverCommand, string>(deployment_coordinates);
+            pump.process<DeployRoverCommand, string>(deployment_coordinates);
         }
 
         public virtual void navigate_rover_using(string navigation_commands)
         {
-            pump.run<NavigateRoverCommand, string>(navigation_commands);
+            pump.process<NavigateRoverCommand, string>(navigation_commands);
         }
 
         public void process_output()
product/project/service/application/CreateMarsCommand.cs
@@ -16,8 +16,7 @@ namespace mars.rover.service.application
         public void run_against(string item)
         {
             var coordinates = item.Split(new[] {' '});
-            var plateau = new Mars(Convert.ToUInt32(coordinates[0]), Convert.ToUInt32(coordinates[1]));
-            nasa.plateau = plateau;
+            nasa.plateau = new Mars(Convert.ToUInt32(coordinates[0]), Convert.ToUInt32(coordinates[1]));
         }
     }
 }
\ No newline at end of file
product/project/service/application/DeployRoverCommand.cs
@@ -4,7 +4,7 @@ using mars.rover.common;
 using mars.rover.domain;
 using mars.rover.presentation.model;
 
-namespace mars.rover.presentation
+namespace mars.rover.service.application
 {
     public class DeployRoverCommand : ParameterizedCommand<string>
     {
product/project/service/application/NavigateRoverCommand.cs
@@ -1,9 +1,10 @@
 using System.Linq;
 using mars.rover.common;
 using mars.rover.domain;
+using mars.rover.presentation;
 using mars.rover.presentation.model;
 
-namespace mars.rover.presentation
+namespace mars.rover.service.application
 {
     public class NavigateRoverCommand : ParameterizedCommand<string>
     {
product/project/project.csproj
@@ -50,7 +50,7 @@
     <Compile Include="common\Registry.cs" />
     <Compile Include="common\ActionCommand.cs" />
     <Compile Include="presentation\infrastructure\CommandFactory.cs" />
-    <Compile Include="presentation\infrastructure\CommandPump.cs" />
+    <Compile Include="presentation\infrastructure\EventProcessor.cs" />
     <Compile Include="presentation\infrastructure\SynchronousCommandPump.cs" />
     <Compile Include="service\application\CreateMarsCommand.cs" />
     <Compile Include="service\application\DeployRoverCommand.cs" />
product/project.specifications/presentation/infrastructure/SynchronousCommandPumpSpecs.cs
@@ -13,7 +13,7 @@ namespace specifications.presentation.infrastructure
     }
 
     public class when_putting_a_command_on_the_command_processor :
-        observations_for_a_sut_with_a_contract<CommandPump, SynchronousCommandPump>
+        observations_for_a_sut_with_a_contract<EventProcessor, SynchronousCommandPump>
     {
         it should_place_the_correct_command_on_the_processor =
             () => processor.received(x => x.add(Arg<Command>.Is.Anything));
@@ -28,7 +28,7 @@ namespace specifications.presentation.infrastructure
                             registry.is_told_to(x => x.all()).it_will_return(correct, incorrect);
                         };
 
-        because b = () => sut.run<Correct, string>("blah");
+        because b = () => sut.process<Correct, string>("blah");
 
         static CommandProcessor processor;
         static Registry<ParameterizedCommand<string>> registry;
product/project.specifications/presentation/CaptureUserInstructionsPresenterSpecs.cs
@@ -16,11 +16,11 @@ namespace specifications.presentation
         context c = () =>
                         {
                             view = the_dependency<CaptureUserInstructionsView>();
-                            pump = the_dependency<CommandPump>();
+                            pump = the_dependency<EventProcessor>();
                         };
 
         static protected CaptureUserInstructionsView view;
-        static protected CommandPump pump;
+        static protected EventProcessor pump;
     }
 
     public class when_initializing_the_user_interface : concerns_for_presenter
@@ -32,7 +32,7 @@ namespace specifications.presentation
 
     public class when_the_user_specifies_the_boundary_of_the_plateau : concerns_for_presenter
     {
-        it should_create_mars_with_the_boundary_coordinates = () => pump.run<CreateMarsCommand, string>(input);
+        it should_create_mars_with_the_boundary_coordinates = () => pump.process<CreateMarsCommand, string>(input);
 
         context c = () => { input = "5 5"; };
 
@@ -43,7 +43,7 @@ namespace specifications.presentation
 
     public class when_the_user_specifies_the_deployment_coordinates : concerns_for_presenter
     {
-        it should_deploy_a_rover_to_those_coordinates = () => pump.run<DeployRoverCommand, string>(input);
+        it should_deploy_a_rover_to_those_coordinates = () => pump.process<DeployRoverCommand, string>(input);
 
         context c = () => { input = "1 2 N"; };
 
@@ -54,7 +54,7 @@ namespace specifications.presentation
 
     public class when_the_user_specifies_the_navigation_instructions : concerns_for_presenter
     {
-        it should_navigate_the_rover_using_those_instructions = () => pump.run<NavigateRoverCommand, string>(input);
+        it should_navigate_the_rover_using_those_instructions = () => pump.process<NavigateRoverCommand, string>(input);
 
         context c = () => { input = "lmlmlmlmm"; };