public async void TestGet() { var builder = new WebHostBuilder() .UseEnvironment("Production") .UseStartup <TestStartup>(); TestServer testServer = new TestServer(builder); var client = new ApiClient(testServer.CreateClient()); ApiProductSubcategoryResponseModel response = await client.ProductSubcategoryGetAsync(1); response.Should().NotBeNull(); }
public async void Get_null_record() { var mock = new ServiceMockFacade <IProductSubcategoryRepository>(); mock.RepositoryMock.Setup(x => x.Get(It.IsAny <int>())).Returns(Task.FromResult <ProductSubcategory>(null)); var service = new ProductSubcategoryService(mock.LoggerMock.Object, mock.RepositoryMock.Object, mock.ModelValidatorMockFactory.ProductSubcategoryModelValidatorMock.Object, mock.BOLMapperMockFactory.BOLProductSubcategoryMapperMock, mock.DALMapperMockFactory.DALProductSubcategoryMapperMock, mock.BOLMapperMockFactory.BOLProductMapperMock, mock.DALMapperMockFactory.DALProductMapperMock); ApiProductSubcategoryResponseModel response = await service.Get(default(int)); response.Should().BeNull(); mock.RepositoryMock.Verify(x => x.Get(It.IsAny <int>())); }
public async void ByName_Exists() { var mock = new ServiceMockFacade <IProductSubcategoryRepository>(); var record = new ProductSubcategory(); mock.RepositoryMock.Setup(x => x.ByName(It.IsAny <string>())).Returns(Task.FromResult(record)); var service = new ProductSubcategoryService(mock.LoggerMock.Object, mock.RepositoryMock.Object, mock.ModelValidatorMockFactory.ProductSubcategoryModelValidatorMock.Object, mock.BOLMapperMockFactory.BOLProductSubcategoryMapperMock, mock.DALMapperMockFactory.DALProductSubcategoryMapperMock, mock.BOLMapperMockFactory.BOLProductMapperMock, mock.DALMapperMockFactory.DALProductMapperMock); ApiProductSubcategoryResponseModel response = await service.ByName(default(string)); response.Should().NotBeNull(); mock.RepositoryMock.Verify(x => x.ByName(It.IsAny <string>())); }
public async void TestGet() { ApiProductSubcategoryResponseModel response = await this.Client.ProductSubcategoryGetAsync(1); response.Should().NotBeNull(); }