Exemplo n.º 1
0
        public async void ByName_Not_Exists()
        {
            var mock = new ServiceMockFacade <IShiftRepository>();

            mock.RepositoryMock.Setup(x => x.ByName(It.IsAny <string>())).Returns(Task.FromResult <Shift>(null));
            var service = new ShiftService(mock.LoggerMock.Object,
                                           mock.RepositoryMock.Object,
                                           mock.ModelValidatorMockFactory.ShiftModelValidatorMock.Object,
                                           mock.BOLMapperMockFactory.BOLShiftMapperMock,
                                           mock.DALMapperMockFactory.DALShiftMapperMock,
                                           mock.BOLMapperMockFactory.BOLEmployeeDepartmentHistoryMapperMock,
                                           mock.DALMapperMockFactory.DALEmployeeDepartmentHistoryMapperMock);

            ApiShiftResponseModel response = await service.ByName(default(string));

            response.Should().BeNull();
            mock.RepositoryMock.Verify(x => x.ByName(It.IsAny <string>()));
        }