public void GetProductVendorByProductNameTest()
        {
         

            string zapytanie = KlasaNarzędziowaEtap3.GetProductVendorByProductName("Decal 1");

            string str = "SUPERSALES INC.";
            if (str != zapytanie) Assert.Fail();
        }
Exemple #2
0
        public void ProductAndVendorNameTest()
        {
            List <Product> query = KlasaNarzędziowaEtap3.GetProductsByName("Adjustable Race");

            if (query.ProductWithItsVendor().Replace("\n", "") != "Adjustable Race-Litware, Inc.")
            {
                Assert.Fail();
            }
        }
        public void GetProductNamesByVendorNameTest()
        {
         

            List<string> products = KlasaNarzędziowaEtap3.GetProductNamesByVendorName("Allenson Cycles");

            List<Product> stala = new List<Product>();
            Product C = (from p in db.Products where p.ProductID == 530 select p).First();
            stala.Add(C);
           if (products[0] != stala[0].Name) Assert.Fail();
           

        }
        public void GetTotalStandardCostByCategoryTest()
        {
           
            ProductCategory C = (from p in db.ProductCategories where p.ProductCategoryID == 1 select p).First();

            decimal zapytanie = (decimal) KlasaNarzędziowaEtap3.GetTotalStandardCostByCategory(C);
            decimal final = (decimal)153913.49;
            //Console.WriteLine(zapytanie);
            //Console.WriteLine(153913.49);

            if (final != zapytanie) Assert.Fail();
            //if(Tools.GetTotalStandardCostByCategory(C) != 153913.49) Assert.Fail();
        }
        public void GetProductsByNameTest()
        {
           
            List<Product> products = KlasaNarzędziowaEtap3.GetProductsByName("Blade");

            List<Product> stala = new List<Product>();
            Product C = (from p in db.Products where p.ProductID == 316 select p).First();
            stala.Add(C);
        

            for (int i = 0; i < products.Count(); i++)
            {
                if (products[i].ProductID != stala[i].ProductID) Assert.Fail();
                if (products[i].Name != stala[i].Name) Assert.Fail();
            }
            if (products.Count() != stala.Count()) Assert.Fail();
        }
        public void GetNProductsFromCategoryTest()
        {
           

            List<Product> zapytanie = KlasaNarzędziowaEtap3.GetNProductsFromCategory("Bikes", 2);

            List<Product> stala = new List<Product>();
            Product C = (from p in db.Products where p.ProductID == 771 select p).First();
            stala.Add(C);
            C = (from p in db.Products where p.ProductID == 772 select p).First();
            stala.Add(C);

            for (int i = 0; i < zapytanie.Count(); i++)
            {
                if (zapytanie[i].ProductID != stala[i].ProductID) Assert.Fail();
                if (zapytanie[i].Name != stala[i].Name) Assert.Fail();
            }
            if (zapytanie.Count() != stala.Count()) Assert.Fail();
        }
        public void GetNRecentlyReviewedProductsTest()
        {
         

            List<Product> zapytanie = KlasaNarzędziowaEtap3.GetNRecentlyReviewedProducts(10);

            List<Product> stala = new List<Product>();
            Product C = (from p in db.Products where p.ProductID == 709 select p).First();
            stala.Add(C);
            C = (from p in db.Products where p.ProductID == 937 select p).First();
            stala.Add(C);
            stala.Add(C);
            C = (from p in db.Products where p.ProductID == 798 select p).First();
            stala.Add(C);

            for (int i = 0; i < zapytanie.Count(); i++)
            {
                if (zapytanie[i].ProductID != stala[i].ProductID) Assert.Fail();
                if (zapytanie[i].Name != stala[i].Name) Assert.Fail();
            }
            if (zapytanie.Count() != stala.Count()) Assert.Fail();
        }