public void GetProductVendorString_MethodSyntaxTest() { using (ProductDataContext db = new ProductDataContext()) { List <Product> products = db.GetProducts(); List <ProductVendor> productVendors = db.GetProductVendors(); string result = products.GetProductVendorString_MethodSyntax(productVendors); string line = result.Substring(0, result.IndexOf('\n') - 1); Assert.AreEqual("Adjustable Race-Litware, Inc.", line); } }
public MyProductsRepository() { using (ProductDataContext db = new ProductDataContext()) { _myProductsList = new List <MyProduct>(); List <Product> products = db.GetProducts(); foreach (Product product in products) { _myProductsList.Add(new MyProduct(product)); } } }
public void GetProductsWithoutCategory_QuerySyntaxTest() { using (ProductDataContext db = new ProductDataContext()) { List <Product> products = db.GetProducts(); List <Product> result = products.GetProductsWithoutCategory_QuerySyntax(); Assert.AreEqual(209, result.Count); foreach (Product res in result) { Assert.IsNull(res.ProductSubcategory); } } }
public void GetPaginatedProducts_MethodSyntax() { using (ProductDataContext db = new ProductDataContext()) { List <Product> products = db.GetProducts(); List <Product> page0 = products.GetPaginatedProducts_MethodSyntax(20, 0); List <Product> page1 = products.GetPaginatedProducts_MethodSyntax(20, 1); Assert.AreEqual(20, page0.Count); Assert.AreEqual(20, page1.Count); Assert.AreEqual(1, page0[0].ProductID); Assert.AreEqual(332, page1[0].ProductID); } }
public IHttpActionResult GetAll() { var data = _objContext.GetProducts(); return(Ok(data)); }