Beispiel #1
0
        public async Task <GetStepArtifactResponse> Get(GetStepArtifactRequest 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 stepArtifact = await stepRepository.GetStepArtifact(step.Id, request.ArtifactName);

            if (stepArtifact == null)
            {
                throw Err.StepArtifactNotFound(request.ArtifactName);
            }

            return(stepArtifact.ConvertTo <GetStepArtifactResponse>());
        }
Beispiel #2
0
        public async Task It_Should_Get_StepArtifact()
        {
            // Arrange
            batchRepository.DoesBatchExist(Arg.Any <string>())
            .Returns(true);

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

            var stepArtifact = StepArtifacts.Binaries;

            stepRepository.GetStepArtifact(Arg.Any <ulong>(), Arg.Any <string>())
            .Returns(stepArtifact);

            var request = new GetStepArtifactRequest();

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

            // Assert
            response.Should().BeEquivalentTo(TestData.DomainModels.StepArtifacts.Binaries,
                                             o => o.ExcludingMissingMembers());
            response.ArtifactName.Should().Be(TestData.DomainModels.StepArtifacts.Binaries.Name);
        }