public void InvokeCommand(CommandWord commandWord, params object[] parameter) { ICalculatorCommand command = this.commandList.FirstOrDefault(c => c.ShouldExecute(commandWord)); if (command == null) { return; } command.PreviousCommandWord = this.commandJournal.LastOrDefault(); try { command.Execute(parameter); // REMARK: This might be an issue as soon as I want to implement undo operations... // Maybe an can-undo flag is required then but a command shouldn't have a status... this.CommandExecuted?.Invoke(this, command.CommandWord); this.AddCommandToJournal(commandWord); } catch (Exception ex) { this.CommandFailed?.Invoke(this, ex); } }
public void AddCommand_Constructor_Test() { // Arrange & Act this.addCommand = new AddCommand(); // Assert Assert.IsNotNull(this.addCommand); }
public void TestInitialize() { this.calculateCommandFactoryMock = new Mock <ICalculateCommandFactory>(); this.calculatorCommandMock = new Mock <ICalculatorCommand>(); this.calculateCommandFactory = this.calculateCommandFactoryMock.Object; this.calculatorCommand = this.calculatorCommandMock.Object; }
public void TestInitialize() { this.calculatorMock = new Mock <ICalculatorCommand>(); this.calculator = this.calculatorMock.Object; }
public void TestInitialize() { this.addCommand = new AddCommand(); }