public void WhenExecuteCommandWithValidPipeline_CommandManager_ShouldThrowException() { string pipelineName = "myPipeline"; var storedDataService = new StoredDataServiceMock() { ExistsPipelineReturn = true }; var commandDefinition = new DeletePipelineCommand(storedDataService); var instance = new CommandManager(_loggerServiceMock, storedDataService, _cryptoServiceMock); instance.RegisterCommand(commandDefinition); var inputRequest = new InputRequest( commandDefinition.GetInvocationCommandName(), commandDefinition.CommandNameParameter.GetInvokeName(), pipelineName); instance.ExecuteInputRequest(inputRequest); var expected = pipelineName; var actual = storedDataService.DeletedPipeline; Assert.Equal(expected, actual); }
public void WhenExecuteCommandWithoutNameParameter_CommandManager_ShouldThrowException() { var storedDataService = new StoredDataServiceMock(); var commandDefinition = new DeletePipelineCommand(storedDataService); var instance = new CommandManager(_loggerServiceMock, storedDataService, _cryptoServiceMock); instance.RegisterCommand(commandDefinition); var inputRequest = new InputRequest( commandDefinition.GetInvocationCommandName()); Assert.Throws <InvalidParamsException>(() => { instance.ExecuteInputRequest(inputRequest); }); }
public void WhenExecuteCommandWithNonExistingPipeline_CommandManager_ShouldThrowException() { string pipelineName = "myPipeline"; var storedDataService = new StoredDataServiceMock() { ExistsPipelineReturn = false }; var commandDefinition = new DeletePipelineCommand(storedDataService); var instance = new CommandManager(_loggerServiceMock, storedDataService, _cryptoServiceMock); instance.RegisterCommand(commandDefinition); var inputRequest = new InputRequest( commandDefinition.GetInvocationCommandName(), commandDefinition.CommandNameParameter.GetInvokeName(), pipelineName); Assert.Throws <PipelineNotFoundException>(() => { instance.ExecuteInputRequest(inputRequest); }); }