예제 #1
0
        public async Task UpdateAsync()
        {
            // Arrange
            _deploymentRepository.Setup(r => r.Get(
                                            It.IsAny <string>(),
                                            It.IsAny <string>())).ReturnsAsync(GetDeployments("createdDeployment.json").First());

            _deploymentRepository.Setup(r => r.Update(
                                            It.IsAny <DeploymentEntity>())).Returns(Task.CompletedTask);

            DeploymentService deploymentService = new DeploymentService(
                new TestOptionsMonitor <AzureDevOpsSettings>(GetAzureDevOpsSettings()),
                new Mock <IAzureDevOpsBuildClient>().Object,
                _httpContextAccessor.Object,
                _deploymentRepository.Object,
                _releaseRepository.Object,
                _applicationInformationService.Object);

            // Act
            await deploymentService.UpdateAsync(GetDeployments("createdDeployment.json").First(), "ttd");

            // Assert
            _deploymentRepository.Verify(r => r.Get(It.IsAny <string>(), It.IsAny <string>()), Times.Once);
            _deploymentRepository.Verify(r => r.Update(It.IsAny <DeploymentEntity>()), Times.Once);
        }