public void ShouldExecuteHelloWorldCommand()
        {
            var message = new HelloWorldCommand {
                Input = "Hola!"
            };
            var dispatcher = container.Resolve <ICommandDispatcher>();

            Assert.AreEqual("Input: Hola! Output: Hello World!", dispatcher.SubmitHelloWorldCommand(message).Message);
        }
Beispiel #2
0
        static void Main(string[] args)
        {
            // Commands allow execution of different actions
            HelloWorldCommand cmd = new HelloWorldCommand();

            cmd.Execute();

            // To pause and read the result
            Console.ReadKey();
        }
        public void GetCommand_HelloWorld_ReturnsHelloWorldCommand()
        {
            // Arrange
            OptionObject2015       optionObject2015      = new OptionObject2015();
            IOptionObjectDecorator optionObjectDecorator = new OptionObjectDecorator(optionObject2015);
            IParameter             parameter             = new Parameter("HelloWorld");
            HelloWorldCommand      expected = new HelloWorldCommand(optionObjectDecorator);

            // Act
            IRunScriptCommand actual = CommandSelector.GetCommand(optionObject2015, parameter);

            // Assert
            Assert.AreEqual(expected.GetType(), actual.GetType());
        }
Beispiel #4
0
        public void Execute_HelloWorldCommand_ErrorCodeEquals3()
        {
            // Arrange
            double expected = 3;

            OptionObject2015       optionObject2015      = new OptionObject2015();
            IOptionObjectDecorator optionObjectDecorator = new OptionObjectDecorator(optionObject2015);
            var command = new HelloWorldCommand(optionObjectDecorator);

            // Act
            var actual = command.Execute();

            // Assert
            Assert.AreEqual(expected, actual.ErrorCode);
        }
Beispiel #5
0
        public void Execute_HelloWorldCommand_ReturnsOptionObject2015()
        {
            // Arrange
            OptionObject2015 expected = new OptionObject2015();

            OptionObject2015       optionObject2015      = new OptionObject2015();
            IOptionObjectDecorator optionObjectDecorator = new OptionObjectDecorator(optionObject2015);
            var command = new HelloWorldCommand(optionObjectDecorator);

            // Act
            var actual = command.Execute();

            // Assert
            Assert.AreEqual(expected.GetType(), actual.GetType());
        }
 public static HelloWorldCommandResult SubmitHelloWorldCommand(this ICommandDispatcher dispatcher, HelloWorldCommand command)
 {
     return(dispatcher.Dispatch <HelloWorldCommand, HelloWorldCommandResult>(command));
 }