public async void Get_ShouldReturnNullBecauseRecordNotFound() { var mock = new ServiceMockFacade <IEventStatusService, IEventStatusRepository>(); mock.RepositoryMock.Setup(x => x.Get(It.IsAny <int>())).Returns(Task.FromResult <EventStatus>(null)); var service = new EventStatusService(mock.LoggerMock.Object, mock.MediatorMock.Object, mock.RepositoryMock.Object, mock.ModelValidatorMockFactory.EventStatusModelValidatorMock.Object, mock.DALMapperMockFactory.DALEventStatusMapperMock, mock.DALMapperMockFactory.DALEventMapperMock); ApiEventStatusServerResponseModel 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 <IEventStatusRepository>(); var record = new EventStatus(); mock.RepositoryMock.Setup(x => x.Get(It.IsAny <int>())).Returns(Task.FromResult(record)); var service = new EventStatusService(mock.LoggerMock.Object, mock.RepositoryMock.Object, mock.ModelValidatorMockFactory.EventStatusModelValidatorMock.Object, mock.BOLMapperMockFactory.BOLEventStatusMapperMock, mock.DALMapperMockFactory.DALEventStatusMapperMock, mock.BOLMapperMockFactory.BOLEventMapperMock, mock.DALMapperMockFactory.DALEventMapperMock); ApiEventStatusResponseModel response = await service.Get(default(int)); response.Should().NotBeNull(); mock.RepositoryMock.Verify(x => x.Get(It.IsAny <int>())); }