Esempio n. 1
0
        public void GetCommand_NoCommandArgument_ReturnsShowUsageCommand()
        {
            var showUsageCommand = new ShowUsageCommand();
            Func<ShowUsageCommand> factory = () => showUsageCommand;

            var target = new CommandFactory(factory, null, null, null, null, null, null, null);
            var command = target.GetCommand(new string[0]);

            Assert.AreSame(showUsageCommand, command);
        }
Esempio n. 2
0
        public void GetCommand_ClearCommandArgument_ReturnsClearCommand()
        {
            var clearCommand = new ClearCommand(null, new []{"-n"});
            Func<string[], ClearCommand> factory = x => clearCommand;

            var target = new CommandFactory(null, null, null, null, null, null, null, factory);
            var command = target.GetCommand(new[] { CommandFactory.ClearArgument });

            Assert.AreSame(clearCommand, command);
        }
Esempio n. 3
0
        public void GetCommand_CleanCommandArgument_PassesTailOfArgumentArray()
        {
            bool wasInvoked = false;
            var inputArguments = new[] { CommandFactory.CleanArgument, "testing"};

            Func<string[], CleanCommand> factory = x =>
                                                       {
                                                           Assert.AreEqual(1, x.Length);
                                                           Assert.AreEqual("testing", x[0]);
                                                           wasInvoked = true;
                                                           return null;
                                                       };

            var target = new CommandFactory(null, null, null, factory, null, null, null, null);
            target.GetCommand(inputArguments);

            Assert.IsTrue(wasInvoked);
        }
Esempio n. 4
0
        public void GetCommand_SmudgeCommandArgument_ReturnsSmudgeCommand()
        {
            var smudgeCommand = new SmudgeCommand(null, null, new string[0]);
            Func<string[], SmudgeCommand> factory = x => smudgeCommand;

            var target = new CommandFactory(null, null, null, null, factory, null, null, null);
            var command = target.GetCommand(new[] { CommandFactory.SmudgeArgument });

            Assert.AreSame(smudgeCommand, command);
        }
Esempio n. 5
0
        public void GetCommand_PushCommandArgument_ReturnsPushCommand()
        {
            var pushCommand = new PushCommand(null, null, new string[0]);
            Func<string[], PushCommand> factory = x => pushCommand;

            var target = new CommandFactory(null, null, null, null, null, factory, null, null);
            var command = target.GetCommand(new[] { CommandFactory.PushArgument });

            Assert.AreSame(pushCommand, command);
        }