예제 #1
0
        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);
        }
예제 #2
0
        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);
            });
        }
예제 #3
0
        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);
            });
        }