public void ChangeToStringImperativ() { using (ProductionDataContext db = new ProductionDataContext()) { List <ProductVendor> vendorList = db.GetFirstNProductVendor(20); List <Product> productList = db.GetFirstNProducts(20); string result = productList.ChangeToStringImperativ(vendorList); string firstPair = result.Substring(0, result.IndexOf('\n') - 1); Assert.AreEqual("Adjustable Race-Litware, Inc.", firstPair); } }
public void SplitToPagesImperativ() { using (ProductionDataContext db = new ProductionDataContext()) { List <Product> productList = db.GetFirstNProducts(20); List <Product> productPage = productList.SplitToPagesImperativ(1, 20); Assert.AreEqual(1, productPage.Count); Assert.AreEqual(productList[19].ProductID, productPage[0].ProductID); } }
public void GetProductsWithoutCategoryImperative() { using (ProductionDataContext db = new ProductionDataContext()) { List <Product> productList = db.GetFirstNProducts(20); List <Product> productListWithoutCategory = productList.GetProductsWithoutCategoryImperativ(); foreach (Product product in productListWithoutCategory) { Assert.IsNull(product.ProductSubcategory); } } }
public void GetProductsWithNRecentReviewsTest() { MyProductRepository.myProducts.Clear(); using (ProductionDataContext db = new ProductionDataContext()) { List <Product> productList = db.GetFirstNProducts(20); foreach (Product product in productList) { MyProductRepository.myProducts.Add(new MyProduct(product)); } List <MyProduct> products = MyProduct.GetProductsWithNRecentReviews(0); Assert.AreEqual(20, products.Count); } }
public void GetNRecentlyReviewedProducts() { MyProductRepository.myProducts.Clear(); using (ProductionDataContext db = new ProductionDataContext()) { List <Product> productList = db.GetFirstNProducts(500); foreach (Product product in productList) { MyProductRepository.myProducts.Add(new MyProduct(product)); } List <MyProduct> products = MyProduct.GetNRecentlyReviewedProducts(1); Assert.AreEqual(1, products.Count); Assert.AreEqual("Road-550-W Yellow, 40", products[0].Name); } }
public void GetMyProductByNameTest() { using (ProductionDataContext db = new ProductionDataContext()) { List <Product> productList = db.GetFirstNProducts(20); foreach (Product product in productList) { MyProductRepository.myProducts.Add(new MyProduct(product)); } List <MyProduct> products = MyProduct.GetMyProductByName("Nut"); Assert.AreEqual(1, products.Count); foreach (Product product in products) { Assert.IsTrue(product.Name.Contains("Nut")); } } }