public void WhenExecuteCommandCmd_CommandManager_ShouldExecuteCommand() { var cmd = "mycommand"; var storedDataService = new StoredDataServiceMock(); var promtpService = new PromptServiceMock(); var commandDefinition = new WindowsCmdCommand(promtpService); var instance = new CommandManager(_loggerServiceMock, storedDataService, _cryptoServiceMock); instance.RegisterCommand(commandDefinition); var inputRequest = new InputRequest( commandDefinition.GetInvocationCommandName(), commandDefinition.CommandCmdParameter.GetInvokeName(), cmd); instance.ExecuteInputRequest(inputRequest); var expected = cmd; var actual = promtpService.RunCommandValue; Assert.Equal(expected, actual); }
public void WhenExecuteCommandWithoutCmd_CommandManager_ShouldThrowException() { var storedDataService = new StoredDataServiceMock(); var promtpService = new PromptServiceMock(); var commandDefinition = new WindowsCmdCommand(promtpService); var instance = new CommandManager(_loggerServiceMock, storedDataService, _cryptoServiceMock); instance.RegisterCommand(commandDefinition); var inputRequest = new InputRequest( commandDefinition.GetInvocationCommandName()); Assert.Throws <InvalidParamsException>(() => { instance.ExecuteInputRequest(inputRequest); }); }