public async void TestGet() { var builder = new WebHostBuilder() .UseEnvironment("Production") .UseStartup <TestStartup>(); TestServer testServer = new TestServer(builder); var client = new ApiClient(testServer.CreateClient()); ApiProductPhotoResponseModel response = await client.ProductPhotoGetAsync(1); response.Should().NotBeNull(); }
public async void Get_null_record() { var mock = new ServiceMockFacade <IProductPhotoRepository>(); mock.RepositoryMock.Setup(x => x.Get(It.IsAny <int>())).Returns(Task.FromResult <ProductPhoto>(null)); var service = new ProductPhotoService(mock.LoggerMock.Object, mock.RepositoryMock.Object, mock.ModelValidatorMockFactory.ProductPhotoModelValidatorMock.Object, mock.BOLMapperMockFactory.BOLProductPhotoMapperMock, mock.DALMapperMockFactory.DALProductPhotoMapperMock, mock.BOLMapperMockFactory.BOLProductProductPhotoMapperMock, mock.DALMapperMockFactory.DALProductProductPhotoMapperMock); ApiProductPhotoResponseModel response = await service.Get(default(int)); response.Should().BeNull(); mock.RepositoryMock.Verify(x => x.Get(It.IsAny <int>())); }
public async void TestGet() { ApiProductPhotoResponseModel response = await this.Client.ProductPhotoGetAsync(1); response.Should().NotBeNull(); }