コード例 #1
0
        public async void Update()
        {
            var mock  = new ServiceMockFacade <IDeploymentRepository>();
            var model = new ApiDeploymentRequestModel();

            mock.RepositoryMock.Setup(x => x.Create(It.IsAny <Deployment>())).Returns(Task.FromResult(new Deployment()));
            mock.RepositoryMock.Setup(x => x.Get(It.IsAny <string>())).Returns(Task.FromResult(new Deployment()));
            var service = new DeploymentService(mock.LoggerMock.Object,
                                                mock.RepositoryMock.Object,
                                                mock.ModelValidatorMockFactory.DeploymentModelValidatorMock.Object,
                                                mock.BOLMapperMockFactory.BOLDeploymentMapperMock,
                                                mock.DALMapperMockFactory.DALDeploymentMapperMock,
                                                mock.BOLMapperMockFactory.BOLDeploymentRelatedMachineMapperMock,
                                                mock.DALMapperMockFactory.DALDeploymentRelatedMachineMapperMock);

            UpdateResponse <ApiDeploymentResponseModel> response = await service.Update(default(string), model);

            response.Should().NotBeNull();
            mock.ModelValidatorMockFactory.DeploymentModelValidatorMock.Verify(x => x.ValidateUpdateAsync(It.IsAny <string>(), It.IsAny <ApiDeploymentRequestModel>()));
            mock.RepositoryMock.Verify(x => x.Update(It.IsAny <Deployment>()));
        }