public void Init()
        {
            var mockedCommandFactory = new Mock<CommandFactory>();
            var mockedICommandExecutable = new Mock<ICommandExecutable>();

            this.commandFactory = mockedCommandFactory.Object;
            this.engine = mockedICommandExecutable.Object;
        }
Example #2
0
 public static void ExecuteCommand(
     this ICommandExecutable executable,
     object args)
 => executable.Command.RunCommand(
     executable.CommandParameter,
     executable.Converter,
     executable.ConverterParameter,
     args);
Example #3
0
 /// <summary>
 /// Creates a concrete implementation of ICommand depending on the received string.
 /// </summary>
 /// <param name="engine">
 /// The context of the command.
 /// </param>
 /// <param name="command">
 /// The command as a string.
 /// </param>
 /// <returns>
 /// The concrete command.
 /// </returns>
 public ICommand GetGommand(ICommandExecutable engine, string command)
 {
     switch (command)
     {
         case "start": 
             return new StartCommand(engine);
         case "top": 
             return new TopCommand(engine);
         case "help": 
             return new HelpCommand(engine);
         case "restart": 
             return new RestartCommand(engine);
         case "exit": 
             return new ExitCommand(engine);
         default: 
             return new NullCommand(engine);
     }
 }
Example #4
0
 /// <summary>
 /// Initializes a new instance of the <see cref="RestartCommand"/> class.
 /// </summary>
 /// <param name="engine">
 /// The context of the command.
 /// </param>
 public RestartCommand(ICommandExecutable engine)
     : base(engine)
 {
 }
 public void CleanUp()
 {
     this.commandFactory = null;
     this.engine = null;
 }
Example #6
0
 /// <summary>
 /// Initializes a new instance of the <see cref="NullCommand"/> class.
 /// </summary>
 /// <param name="engine">
 /// The context of the command.
 /// </param>
 public NullCommand(ICommandExecutable engine)
     : base(engine)
 {
 }
Example #7
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ExitCommand"/> class.
 /// </summary>
 /// <param name="engine">
 /// The context of the command.
 /// </param>
 public ExitCommand(ICommandExecutable engine)
     : base(engine)
 {
 }
Example #8
0
 /// <summary>
 /// Initializes a new instance of the <see cref="TopCommand"/> class.
 /// </summary>
 /// <param name="engine">
 /// The context of the command.
 /// </param>
 public TopCommand(ICommandExecutable engine)
     : base(engine)
 {
 }
Example #9
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Command"/> class.
 /// </summary>
 /// <param name="engine">
 /// The context of the command.
 /// </param>
 protected Command(ICommandExecutable engine)
 {
     this.Engine = engine;
 }