示例#1
0
        public void GetNRecentlyReviewedProductsTest()
        {
            List <Product> products = LINQ_tools.GetNRecentlyReviewedProducts(2);

            Assert.AreEqual(products.Count(), 2);
            Assert.AreEqual(products[0].ProductNumber, "PD-M562");
        }
示例#2
0
        public void GetNProductsFromCategoryTest()
        {
            List <Product> products = LINQ_tools.GetNProductsFromCategory("Bikes", 4);

            Assert.AreEqual(products.Count(), 4);
            Assert.AreEqual(products[0].ProductNumber, "BK-M82S-38");
        }
示例#3
0
        public void GetProductsByVendorNameTest()
        {
            List <Product> products = LINQ_tools.GetProductsByVendorName("Australia Bike Retailer");

            Assert.AreEqual(products.Count(), 16);
            Assert.AreEqual(products[0].ProductNumber, "LJ-1213");
        }
示例#4
0
        public void GetProductsWithNRecentReviewsTest()
        {
            List <Product> products = LINQ_tools.GetProductsWithNRecentReviews(1);

            Assert.AreEqual(products.Count(), 2);
            Assert.AreEqual(products[0].ProductNumber, "SO-B909-M");
        }
示例#5
0
        public void GetProductNamesByVendorNameTest()
        {
            List <string> products = LINQ_tools.GetProductNamesByVendorName("Australia Bike Retailer");

            Assert.AreEqual(products.Count(), 16);
            Assert.AreEqual(products[0], "Thin-Jam Lock Nut 9");
        }
示例#6
0
        public void GetProductsByNameTest()
        {
            List <Product> products = LINQ_tools.GetProductsByName("Down Tube");

            Assert.AreEqual(products.Count(), 1);
            Assert.AreEqual(products[0].ProductNumber, "DT-2377");
        }
示例#7
0
        public void GetTotalStandardCostByCategoryTest()
        {
            ProductCategory category = new ProductCategory();

            category.Name = "Bikes";

            int sum = LINQ_tools.GetTotalStandardCostByCategory(category);

            Assert.AreEqual(sum, 92092);
        }
示例#8
0
        public IEnumerable <MyProduct> GetAllProducts()
        {
            List <MyProduct> myProducts = new List <MyProduct>();

            foreach (Product p in LINQ_tools.GetAllProducts())
            {
                myProducts.Add(new MyProduct(p));
            }
            return(myProducts);
            //return (IEnumerable<MyProduct>)LINQ_tools.GetAllProducts();
        }
示例#9
0
        public void Update(MyProduct product)
        {
            Product p = new Product();

            p.ProductID        = product.ProductID;
            p.ProductNumber    = product.ProductNumber;
            p.Name             = product.Name;
            p.ModifiedDate     = product.ModifiedDate;
            p.SellStartDate    = product.SellStartDate;
            p.SellEndDate      = product.SellEndDate;
            p.SafetyStockLevel = product.SafetyStockLevel;
            p.ReorderPoint     = product.ReorderPoint;
            p.Color            = product.Color;
            p.rowguid          = product.rowguid;
            LINQ_tools.UpdateProduct(p);
            product.ProductID = p.ProductID;
        }
示例#10
0
        public void GetProductVendorByProductNameTest()
        {
            string vendors = LINQ_tools.GetProductVendorByProductName("Decal 2");

            Assert.AreEqual(vendors, "SUPERSALES INC.");
        }
示例#11
0
 public void Delete(int id)
 {
     LINQ_tools.DeleteProductId(id);
 }
示例#12
0
        public MyProduct Read(int id)
        {
            Product p = LINQ_tools.GetProductById(id);

            return(new MyProduct(p));
        }