Exemple #1
0
 public SourceCommandTests()
 {
     this.commandStub = new ICommandStub
                             {
                                 Args = "arg1 arg2 arg3",
                                 Name = "stubcmd",
                                 Help = "sample help!"
                             };
     this.commandHandlerStubReturnsTrue = new ICommandHandlerStub
                                               {
                                                   ExpectedCommandArgs = this.commandStub.Args,
                                                   ExpectedCommandName = this.commandStub.Name,
                                                   ExpectedCommandHelp = this.commandStub.Help,
                                                   ExpectedExecuteResult = () => true
                                               };
     var failCommandStub = new ICommandStub2
                             {
                                 Args = "arg1 arg2 arg3",
                                 Name = "stubcmd2",
                                 Help = "sample help!"
                             };
     var commandHandlerStubReturnsFalse = new ICommandHandlerStub2
                                               {
                                                   ExpectedCommandArgs = failCommandStub.Args,
                                                   ExpectedCommandName = failCommandStub.Name,
                                                   ExpectedCommandHelp = failCommandStub.Help,
                                                   ExpectedExecuteResult = () => false
                                               };
     this.commandService = new CommandService(
         new List<ICommand> { this.commandStub, failCommandStub }, new List<object> { this.commandHandlerStubReturnsTrue, commandHandlerStubReturnsFalse });
     this.sourceCommandHandler = new SourceCommandHandler(this.commandService);
 }
Exemple #2
0
 public CommandServiceTests()
 {
     this.commandStub = new ICommandStub
                             {
                                 Args = "arg1 arg2 arg3",
                                 Name = "stubcmd",
                                 Help = "sample help!"
                             };
     this.commandHandlerStubReturnsFalse = this.GetCommandHandler(this.commandStub, () => false);
     this.commandHandlerStubReturnsTrue = this.GetCommandHandler(this.commandStub, () => true);
 }
        public DefinekeyCommandTests()
        {
            this.platformFacade = Substitute.For<IPlatformFacade>();
            this.keyMapService = new KeyMapService(this.platformFacade);

            var commandStub = new ICommandStub
                                    {
                                        Args = "arg1",
                                        Name = "testCommand",
                                        Help = "sample help!"
                                    };
            var commandHandlerStub = new ICommandHandlerStub
                       {
                           ExpectedCommandArgs = commandStub.Args,
                           ExpectedCommandName = commandStub.Name,
                           ExpectedCommandHelp = commandStub.Help,
                           ExpectedExecuteResult = () => true
                       };
            this.commandService = new CommandService(
                new List<ICommand> { commandStub }, new List<object> { commandHandlerStub });
        }
Exemple #4
0
 private ICommandHandlerStub GetCommandHandler(ICommandStub cmdStub, Func<bool> result)
 {
     return new ICommandHandlerStub
                {
                    ExpectedCommandArgs = cmdStub.Args,
                    ExpectedCommandName = cmdStub.Name,
                    ExpectedCommandHelp = cmdStub.Help,
                    ExpectedExecuteResult = result
                };
 }