public async void ByName_Not_Exists() { var mock = new ServiceMockFacade <ILocationRepository>(); mock.RepositoryMock.Setup(x => x.ByName(It.IsAny <string>())).Returns(Task.FromResult <Location>(null)); var service = new LocationService(mock.LoggerMock.Object, mock.RepositoryMock.Object, mock.ModelValidatorMockFactory.LocationModelValidatorMock.Object, mock.BOLMapperMockFactory.BOLLocationMapperMock, mock.DALMapperMockFactory.DALLocationMapperMock, mock.BOLMapperMockFactory.BOLProductInventoryMapperMock, mock.DALMapperMockFactory.DALProductInventoryMapperMock, mock.BOLMapperMockFactory.BOLWorkOrderRoutingMapperMock, mock.DALMapperMockFactory.DALWorkOrderRoutingMapperMock); ApiLocationResponseModel response = await service.ByName(default(string)); response.Should().BeNull(); mock.RepositoryMock.Verify(x => x.ByName(It.IsAny <string>())); }