public async Task It_Should_Get_Command() { // Arrange batchRepository.DoesBatchExist(Arg.Any <string>()) .Returns(true); stepRepository.Get(Arg.Any <string>(), Arg.Any <string>()) .Returns(new Step()); var command = TestData.Entities.Commands.DotNetRestore; command.StepId = 123; commandRepository.Get(Arg.Any <ulong>(), Arg.Any <string>()).Returns(command); var request = new GetCommandRequest { BatchId = TestBatchId, StepName = TestStepName, CommandName = TestCommandName }; // Act var response = await Sut.Get(request); // Assert response.Should().BeEquivalentTo(TestData.DomainModels.Commands.DotNetRestore, o => o.ExcludingMissingMembers()); response.CommandName.Should().Be(TestData.DomainModels.Commands.DotNetRestore.Name); }
public async Task <CreateCommandVariableResponse> Post(CreateCommandVariableRequest request) { if (!await batchRepository.DoesBatchExist(request.BatchId)) { throw Err.BatchNotFound(request.BatchId); } var step = await stepRepository.Get(request.BatchId, request.StepName); if (step == null) { throw Err.StepNotFound(request.StepName); } var command = await commandRepository.Get(step.Id, request.CommandName); if (command == null) { throw Err.CommandNotFound(request.CommandName); } if (await commandRepository.DoesCommandVariableExist(request.BatchId, request.StepName, request.CommandName, request.VariableName)) { throw Err.CommandVariableAlreadyExists(request.VariableName); } var commandVariable = request.ConvertTo <CommandVariable>(); commandVariable.CommandId = command.Id; await commandRepository.CreateOrUpdateCommandVariable(commandVariable); return(new CreateCommandVariableResponse()); }
public CommandModel Get(int id) { var command = _commandQueue.Find(id); if (command == null) { command = _repo.Get(id); } return(command); }
public void OnNewCommand(InvokeHeader invoke_header) { var command_header = _commandRepository.Get(new[] { invoke_header }).First(); _functionRepository.AddHeaders(new [] { command_header.FunctionHeader }); _dataCellRepository.AddHeaders(new [] { command_header.OutputDataHeader }); _dataCellRepository.AddHeaders(command_header.InputDataHeaders); //Console.WriteLine(string.Format("CommandManager.OnNewCommand Callstack={0}", string.Join("/", invoke_header.CallStack))); PrepareOrSendToWait(new[] { command_header }); }
public async Task <GetCommandResponse> Get(GetCommandRequest request) { if (!await batchRepository.DoesBatchExist(request.BatchId)) { throw Err.BatchNotFound(request.BatchId); } var step = await stepRepository.Get(request.BatchId, request.StepName); if (step == null) { throw Err.StepNotFound(request.StepName); } var command = await commandRepository.Get(step.Id, request.CommandName); if (command == null) { throw Err.CommandNotFound(request.CommandName); } return(command.ConvertTo <GetCommandResponse>()); }
public async Task It_Should_Create_CommandVariable() { // Arrange batchRepository.DoesBatchExist(Arg.Any <string>()) .Returns(true); stepRepository.Get(Arg.Any <string>(), Arg.Any <string>()).Returns(new Step()); commandRepository.Get(Arg.Any <ulong>(), Arg.Any <string>()).Returns(new Command { Id = 123 }); commandRepository.DoesCommandVariableExist(Arg.Any <string>(), Arg.Any <string>(), Arg.Any <string>(), Arg.Any <string>()) .Returns(false); var request = CreateCommandVariables.Extract; request.BatchId = TestBatchId; request.StepName = TestStepName; request.CommandName = TestCommandName; // Act var response = await Sut.Post(request); // Assert response.Should().NotBeNull(); await commandRepository.Received().CreateOrUpdateCommandVariable(Arg.Is <CommandVariable>(a => a.CommandId == 123 && a.Name == request.VariableName && a.Description == request.Description)); }
public Task <Command> GetById(Guid id) { return(_repo.Get(id)); }
public IEnumerable <CommandHeader> GetCommandHeaders(IEnumerable <InvokeHeader> invoke_header) { return(_commandRepository.Get(invoke_header)); }
public CommandModel Get(int id) { return(_commandCache.Get(id.ToString(), () => FindCommand(_repository.Get(id)))); }