public async void Get_null_record() { var mock = new ServiceMockFacade <ILinkTypeRepository>(); mock.RepositoryMock.Setup(x => x.Get(It.IsAny <int>())).Returns(Task.FromResult <LinkType>(null)); var service = new LinkTypeService(mock.LoggerMock.Object, mock.RepositoryMock.Object, mock.ModelValidatorMockFactory.LinkTypeModelValidatorMock.Object, mock.BOLMapperMockFactory.BOLLinkTypeMapperMock, mock.DALMapperMockFactory.DALLinkTypeMapperMock); ApiLinkTypeResponseModel response = await service.Get(default(int)); response.Should().BeNull(); mock.RepositoryMock.Verify(x => x.Get(It.IsAny <int>())); }
public async void Get_ShouldReturnRecords() { var mock = new ServiceMockFacade <ILinkTypeService, ILinkTypeRepository>(); var record = new LinkType(); mock.RepositoryMock.Setup(x => x.Get(It.IsAny <int>())).Returns(Task.FromResult(record)); var service = new LinkTypeService(mock.LoggerMock.Object, mock.MediatorMock.Object, mock.RepositoryMock.Object, mock.ModelValidatorMockFactory.LinkTypeModelValidatorMock.Object, mock.DALMapperMockFactory.DALLinkTypeMapperMock, mock.DALMapperMockFactory.DALPostLinkMapperMock); ApiLinkTypeServerResponseModel response = await service.Get(default(int)); response.Should().NotBeNull(); mock.RepositoryMock.Verify(x => x.Get(It.IsAny <int>())); }