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

            stepRepository.DoesStepExist(Arg.Any <string>(), Arg.Any <string>())
            .Returns(false);

            var request = CreateSteps.Build;

            request.BatchId = TestBatchId;

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

            // Assert
            response.Should().NotBeNull();
            await stepRepository.Received().Create(Arg.Is <Step>(a =>
                                                                 a.BatchId == request.BatchId &&
                                                                 a.Name == request.StepName &&
                                                                 a.Description == request.Description &&
                                                                 a.Options.Count == request.Options.Count &&
                                                                 a.Variables.Count == request.Variables.Count &&
                                                                 a.Commands.Count == request.Commands.Count &&
                                                                 a.Artifacts.Count == request.Artifacts.Count));
        }
Esempio n. 2
0
        public async Task It_Should_Create_StepOption()
        {
            // Arrange
            batchRepository.DoesBatchExist(Arg.Any <string>())
            .Returns(true);

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

            stepRepository.DoesStepOptionExist(Arg.Any <string>(), Arg.Any <string>(), Arg.Any <string>())
            .Returns(false);

            var request = CreateStepOptions.BuildAlways;

            request.BatchId  = TestBatchId;
            request.StepName = TestStepName;

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

            // Assert
            response.Should().NotBeNull();
            await stepRepository.Received().CreateOrUpdateStepOption(Arg.Is <StepOption>(a =>
                                                                                         a.StepId == 123 &&
                                                                                         a.Name == request.OptionName &&
                                                                                         a.Description == request.Description));
        }