Exemplo n.º 1
0
        public void CatalogRepository_ProductFilter_Returns_5_Products_With_Category_11()
        {
            ICatalogRepository rep = new TestCatalogRepository();

            Assert.AreEqual(5, rep.GetProducts()
                            .WithCategory(11)
                            .Count());
        }
Exemplo n.º 2
0
        public void CatalogRepository_Returns_Single_Product_When_Filtered_By_ID_1()
        {
            ICatalogRepository rep = new TestCatalogRepository();

            Assert.AreEqual(1,
                            rep.GetProducts()
                            .WithID(1)
                            .ToList().Count());
        }
Exemplo n.º 3
0
        public void CatalogRepository_Has_Category_Filter_ForProducts()
        {
            ICatalogRepository rep = new TestCatalogRepository();

            IList <Product> prod = rep.GetProducts()
                                   .WithCategory(11)
                                   .ToList();

            Assert.IsNotNull(prod);
        }
Exemplo n.º 4
0
        public void CatalogRepository_Each_Category_Contains_5_Products()
        {
            ICatalogRepository rep = new TestCatalogRepository();

            var cat = rep.GetCategories()
                      .Where(x => x.ParentID.HasValue)
                      .ToList();

            Assert.AreEqual(10, cat.Count());

            var prod = rep.GetProducts();

            foreach (Category c in cat)
            {
                int prodCount = (from p in prod
                                 where p.CategoryID == c.ID
                                 select p).Count();
                Assert.AreEqual(5, prodCount, String.Format("For category {0}", c.ID));
            }

            Assert.IsNotNull(rep.GetProducts());
        }
Exemplo n.º 5
0
        public void CatalogRepository_Contains_Products()
        {
            ICatalogRepository r = new TestCatalogRepository();

            Assert.IsNotNull(r.GetProducts());
        }
Exemplo n.º 6
0
        public void Setup()
        {
            ICatalogRepository rep = new TestCatalogRepository();

            catalogService = new CatalogService(rep);
        }
Exemplo n.º 7
0
        public void CatalogRepository_Repository_Is_Not_Null()
        {
            ICatalogRepository rep = new TestCatalogRepository();

            Assert.IsNotNull(rep.GetCategories());
        }