Exemplo n.º 1
0
        public void InvalidArgumentsTest()
        {
            ICommand command       = new EchoCommand();
            var      commandResult = command.Execute(null);

            Assert.IsNotNull(commandResult);
            Assert.AreEqual(commandResult.Count(), 1);
            Assert.AreEqual("Invalid arguments", commandResult.First());
        }
Exemplo n.º 2
0
        public void Execute_Should_Write_To_Console_All_But_First_Word()
        {
            //Arrange

            //Act
            cmd.Execute("echo this is a test");

            //Assert
            mock.AssertWasCalled(m => m.WriteLine("this is a test"));
        }
Exemplo n.º 3
0
        public void ExecuteTest()
        {
            ICommand command = new EchoCommand();

            // single argument test
            var arguments = new List <string>()
            {
                "Something"
            };
            var commandResult = command.Execute(arguments);

            Assert.IsNotNull(commandResult);
            Assert.AreEqual(commandResult.Count(), 1);
            Assert.AreEqual("Something", commandResult.First());

            // multi argiment test
            arguments.Add("Something more");
            commandResult = command.Execute(arguments);
            Assert.IsNotNull(commandResult);
            Assert.AreEqual(commandResult.Count(), 2);
            Assert.AreEqual("Something", commandResult.First());
            Assert.AreEqual("Something more", commandResult.Last());
        }