Ejemplo n.º 1
0
        public async void Create()
        {
            var mock  = new ServiceMockFacade <IErrorLogRepository>();
            var model = new ApiErrorLogRequestModel();

            mock.RepositoryMock.Setup(x => x.Create(It.IsAny <ErrorLog>())).Returns(Task.FromResult(new ErrorLog()));
            var service = new ErrorLogService(mock.LoggerMock.Object,
                                              mock.RepositoryMock.Object,
                                              mock.ModelValidatorMockFactory.ErrorLogModelValidatorMock.Object,
                                              mock.BOLMapperMockFactory.BOLErrorLogMapperMock,
                                              mock.DALMapperMockFactory.DALErrorLogMapperMock);

            CreateResponse <ApiErrorLogResponseModel> response = await service.Create(model);

            response.Should().NotBeNull();
            mock.ModelValidatorMockFactory.ErrorLogModelValidatorMock.Verify(x => x.ValidateCreateAsync(It.IsAny <ApiErrorLogRequestModel>()));
            mock.RepositoryMock.Verify(x => x.Create(It.IsAny <ErrorLog>()));
        }