示例#1
0
        public async void Get_ShouldReturnNullBecauseRecordNotFound()
        {
            var mock = new ServiceMockFacade <IPipelineStepStatusService, IPipelineStepStatusRepository>();

            mock.RepositoryMock.Setup(x => x.Get(It.IsAny <int>())).Returns(Task.FromResult <PipelineStepStatus>(null));
            var service = new PipelineStepStatusService(mock.LoggerMock.Object,
                                                        mock.MediatorMock.Object,
                                                        mock.RepositoryMock.Object,
                                                        mock.ModelValidatorMockFactory.PipelineStepStatusModelValidatorMock.Object,
                                                        mock.DALMapperMockFactory.DALPipelineStepStatusMapperMock,
                                                        mock.DALMapperMockFactory.DALPipelineStepMapperMock);

            ApiPipelineStepStatusServerResponseModel response = await service.Get(default(int));

            response.Should().BeNull();
            mock.RepositoryMock.Verify(x => x.Get(It.IsAny <int>()));
        }
        public async void Get()
        {
            var mock   = new ServiceMockFacade <IPipelineStepStatusRepository>();
            var record = new PipelineStepStatus();

            mock.RepositoryMock.Setup(x => x.Get(It.IsAny <int>())).Returns(Task.FromResult(record));
            var service = new PipelineStepStatusService(mock.LoggerMock.Object,
                                                        mock.RepositoryMock.Object,
                                                        mock.ModelValidatorMockFactory.PipelineStepStatusModelValidatorMock.Object,
                                                        mock.BOLMapperMockFactory.BOLPipelineStepStatusMapperMock,
                                                        mock.DALMapperMockFactory.DALPipelineStepStatusMapperMock,
                                                        mock.BOLMapperMockFactory.BOLPipelineStepMapperMock,
                                                        mock.DALMapperMockFactory.DALPipelineStepMapperMock);

            ApiPipelineStepStatusResponseModel response = await service.Get(default(int));

            response.Should().NotBeNull();
            mock.RepositoryMock.Verify(x => x.Get(It.IsAny <int>()));
        }