示例#1
0
        public void GetProductVendorByProductName_ShouldReturnProperValues()
        {
            var productName = "Reflector";
            var vendor      = DM.GetProductVendorByProductName(productName);

            Assert.AreEqual(vendor, "Chicago Rent-All");
        }
示例#2
0
        public void GetProductsWithNRecentReviews_ShouldReturnProperValues()
        {
            var products = DM.GetProductsWithNRecentReviews(2);

            Assert.AreEqual(products.Count, 1);
            Assert.IsNotNull(products.Find(p => p.ProductID == 937));
        }
示例#3
0
        public void GetNProductsFromCategory_ShouldReturnProperValues()
        {
            var categoryName   = "Accessories";
            var productAmounts = 5;
            var products       = DM.GetNProductsFromCategory(categoryName, productAmounts);

            Assert.AreEqual(products.Count, productAmounts);
        }
示例#4
0
        public void GetNRecentlyReviewedProductsImperative_ShouldReturnProperValues()
        {
            var products = DM.GetNRecentlyReviewedProductsImperative(2);

            Assert.AreEqual(products.Count, 2);
            Assert.IsNotNull(products.Find(p => p.ProductID == 798));
            Assert.IsNotNull(products.Find(p => p.ProductID == 937));
        }
示例#5
0
        public void GetPagedExtensionMethod()
        {
            var categoryName   = "Accessories";
            var productAmounts = 10;
            var products       = DM.GetNProductsFromCategory(categoryName, productAmounts);
            var page           = products.GetPaged(3, 2);

            Assert.AreEqual(page.Count, 3);
        }
示例#6
0
        public void GetProductsNamesByVendorName_ShouldReturnProperValues()
        {
            var vendorName     = "Capital Road Cycles";
            var productAmounts = 2;
            var products       = DM.GetProductsNamesByVendorName(vendorName);

            Assert.AreEqual(products.Count, productAmounts);
            Assert.IsNotNull(products.Find(p => p == "LL Spindle/Axle"));
            Assert.IsNotNull(products.Find(p => p == "HL Spindle/Axle"));
        }
示例#7
0
        public void GetProductsByName_ShouldReturnProperValues()
        {
            var name     = "Fork";
            var products = DM.GetProductsByName(name);

            foreach (var p in products)
            {
                Assert.IsTrue(p.Name.Contains(name));
            }
        }
示例#8
0
        public void GetProductsAndTheirVendors()
        {
            var categoryName   = "Accessories";
            var productAmounts = 2;
            var products       = DM.GetNProductsFromCategory(categoryName, productAmounts); // helper
            var report         = products.GetProductsAndTheirVendors();

            foreach (var p in products)
            {
                Assert.IsTrue(report.Contains(p.Name));
            }
        }
示例#9
0
        public void GetTotalStandardCostByCategory_NonExistingCategory()
        {
            var categoryId      = 5;
            var properTotalCost = 0;
            var returnedCost    = DM.GetTotalStandardCostByCategory(
                new ProductCategory
            {
                ProductCategoryID = categoryId
            });

            Assert.AreEqual(returnedCost, properTotalCost);
        }
示例#10
0
        public void GetTotalStandardCostByCategory_ShouldReturnProperValues()
        {
            var categoryId      = 4;
            var properTotalCost = 384;
            var returnedCost    = DM.GetTotalStandardCostByCategory(
                new ProductCategory
            {
                ProductCategoryID = categoryId
            });

            Assert.AreEqual(returnedCost, properTotalCost);
        }