public async Task <GetAllStepArtifactResponse> Get(GetAllStepArtifactRequest 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 stepArtifacts = await stepRepository.GetAllStepArtifacts(step.Id);

            var response = new GetAllStepArtifactResponse
            {
                Artifacts = stepArtifacts.ConvertTo <List <DomainModels.StepArtifact> >()
            };

            return(response);
        }
Exemple #2
0
        public async Task It_Should_Get_All_StepArtifact()
        {
            // Arrange
            batchRepository.DoesBatchExist(Arg.Any <string>())
            .Returns(true);

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

            var stepArtifacts = TestData.Entities.Steps.Build.Artifacts;

            stepRepository.GetAllStepArtifacts(Arg.Any <ulong>())
            .Returns(stepArtifacts);

            var request = new GetAllStepArtifactRequest();

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

            // Assert
            response.Artifacts.Should().BeEquivalentTo(TestData.DomainModels.Steps.Build.Artifacts);
        }