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

            this.commandFactory = mockedCommandFactory.Object;
            this.engine = mockedICommandExecutable.Object;
        }
Beispiel #2
0
 public static void ExecuteCommand(
     this ICommandExecutable executable,
     object args)
 => executable.Command.RunCommand(
     executable.CommandParameter,
     executable.Converter,
     executable.ConverterParameter,
     args);
 /// <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);
     }
 }
 /// <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;
 }
Beispiel #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)
 {
 }
Beispiel #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)
 {
 }
Beispiel #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)
 {
 }
Beispiel #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;
 }