public async Task GetProductTypes_ShouldReturnAllProductTypes_HappyFlow() { List <ProductType> productTypes = new List <ProductType> { new ProductType() { ProductTypeId = 1, ProductType1 = "tomato", Msp = 50 }, new ProductType() { ProductTypeId = 2, ProductType1 = "potato", Msp = 60 } }; _orchard1Context.AddRange(productTypes.ToArray()); _orchard1Context.SaveChanges(); List <ProductType> testResult = await _adminRepository.GetProductTypes(); CollectionAssert.AreEqual(productTypes, testResult); }
public async Task GetProductTypes_ThrowsException_BadFlow() { orchard1ContextMock.Setup(s => s.ProductType).Throws(new GeneralException()); await Assert.ThrowsExceptionAsync <GeneralException>(async() => await adminRepository.GetProductTypes()); }
public async Task <List <ProductType> > GetProductTypes() { return(await _AdminData.GetProductTypes()); }