Commit d360fb1

unknown <mkhan@.arcresources.ca>
2009-10-08 13:59:25
fixed one broken test where the implicit cast was causing a mock setup to not return a stubbed value.
1 parent 330c91b
Changed files (3)
product/application/CommandRegistry.cs
@@ -2,7 +2,7 @@ namespace simple.migrations
 {
     public interface CommandRegistry
     {
-        ParameterizedCommand<ConsoleArguments> command_for(string[] arguments);
+        ParameterizedCommand<ConsoleArguments> command_for(ConsoleArguments arguments);
         void register(ConsoleCommand command);
     }
 }
\ No newline at end of file
product/application/ConsoleArgumentsCommandRegistry.cs
@@ -7,9 +7,9 @@ namespace simple.migrations
     {
         readonly IList<ConsoleCommand> all_commands = new List<ConsoleCommand>();
 
-        public ParameterizedCommand<ConsoleArguments> command_for(string[] arguments)
+        public ParameterizedCommand<ConsoleArguments> command_for(ConsoleArguments arguments)
         {
-            if(all_commands.Any(x => x.can_handle(arguments)))
+            if (all_commands.Any(x => x.can_handle(arguments)))
                 return all_commands.Single(x => x.can_handle(arguments));
             return new HelpCommand();
         }
product/application.tests/CommandRegistrySpecs.cs
@@ -13,12 +13,13 @@ namespace tests
             context c = () =>
                             {
                                 command = controller.an<ConsoleCommand>();
+                                correct_args = controller.an<ConsoleArguments>();
                                 command.Stub(x => x.can_handle(correct_args)).Return(true);
                             };
 
             after_the_sut_has_been_created a = () => { controller.sut.register(command); };
 
-            protected static readonly string[] correct_args = new[] {""};
+            protected static ConsoleArguments correct_args;
             protected static ConsoleCommand command;
         }
 
@@ -39,7 +40,7 @@ namespace tests
 
             because b = () => { result = controller.sut.command_for(unknown_args); };
 
-            static readonly ConsoleArguments unknown_args = new[] {""};
+            static readonly string[] unknown_args = new[] {""};
             static ParameterizedCommand<ConsoleArguments> result;
         }
     }