public void RemovingNotExistingCommandShouldThrow() { BasicUIRenderer basicUIRenderer = new ConsoleUIRenderer(); var command = new ExitCommand(basicUIRenderer, "test"); var mockedCommandComposer = new Mock<CommandComposer>(basicUIRenderer); mockedCommandComposer.Setup(x => x.Execute()).Throws(new Exception()); mockedCommandComposer.Object.AddCommand(command); }
public void ExecuteCommandShouldNotThrow() { BasicUIRenderer basicUIRenderer = new ConsoleUIRenderer(); var command = new ExitCommand(basicUIRenderer, "test"); var mockedCommandComposer = new Mock<CommandComposer>(basicUIRenderer); mockedCommandComposer.Object.AddCommand(command); mockedCommandComposer.Object.Execute(); mockedCommandComposer.Verify(x => x.Execute(), Times.Once()); }
public void AddingAndRemovingCommandShouldResultInCountOfAvailableCommandsEqualToZero() { BasicUIRenderer basicUIRenderer = new ConsoleUIRenderer(); var command = new ExitCommand(basicUIRenderer, "test"); var mockedCommandComposer = new Mock<CommandComposer>(basicUIRenderer); mockedCommandComposer.Object.AddCommand(command); mockedCommandComposer.Setup(x => x.Execute()); mockedCommandComposer.Object.RemoveExecutedCommand(); mockedCommandComposer.Setup(x => x.Execute()).Throws(new Exception()); }