Ejemplo n.º 1
0
        public async Task It_Should_Get_StepVariable()
        {
            // Arrange
            batchRepository.DoesBatchExist(Arg.Any <string>())
            .Returns(true);

            stepRepository.Get(Arg.Any <string>(), Arg.Any <string>()).Returns(new Step
            {
                Id = 123
            });

            var stepVariable = StepVariables.SourcePath;

            stepRepository.GetStepVariable(Arg.Any <ulong>(), Arg.Any <string>())
            .Returns(stepVariable);

            var request = new GetStepVariableRequest();

            // Act
            var response = await Sut.Get(request);

            // Assert
            response.Should().BeEquivalentTo(TestData.DomainModels.StepVariables.SourcePath,
                                             o => o.ExcludingMissingMembers());
            response.VariableName.Should().Be(TestData.DomainModels.StepVariables.SourcePath.Name);
        }
Ejemplo n.º 2
0
        public async Task <GetStepVariableResponse> Get(GetStepVariableRequest 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 stepVariable = await stepRepository.GetStepVariable(step.Id, request.VariableName);

            if (stepVariable == null)
            {
                throw Err.StepVariableNotFound(request.VariableName);
            }

            return(stepVariable.ConvertTo <GetStepVariableResponse>());
        }