public async void Get_ShouldReturnNullBecauseRecordNotFound() { var mock = new ServiceMockFacade<ILinkStatusService, ILinkStatusRepository>(); mock.RepositoryMock.Setup(x => x.Get(It.IsAny<int>())).Returns(Task.FromResult<LinkStatus>(null)); var service = new LinkStatusService(mock.LoggerMock.Object, mock.MediatorMock.Object, mock.RepositoryMock.Object, mock.ModelValidatorMockFactory.LinkStatusModelValidatorMock.Object, mock.DALMapperMockFactory.DALLinkStatusMapperMock, mock.DALMapperMockFactory.DALLinkMapperMock); ApiLinkStatusServerResponseModel 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 <ILinkStatusRepository>(); var record = new LinkStatus(); mock.RepositoryMock.Setup(x => x.Get(It.IsAny <int>())).Returns(Task.FromResult(record)); var service = new LinkStatusService(mock.LoggerMock.Object, mock.RepositoryMock.Object, mock.ModelValidatorMockFactory.LinkStatusModelValidatorMock.Object, mock.BOLMapperMockFactory.BOLLinkStatusMapperMock, mock.DALMapperMockFactory.DALLinkStatusMapperMock, mock.BOLMapperMockFactory.BOLLinkMapperMock, mock.DALMapperMockFactory.DALLinkMapperMock); ApiLinkStatusResponseModel response = await service.Get(default(int)); response.Should().NotBeNull(); mock.RepositoryMock.Verify(x => x.Get(It.IsAny <int>())); }