コード例 #1
0
        public void CatalogRepository_ProductFilter_Returns_5_Products_With_Category_11()
        {
            ICatalogRepository rep = new TestCatalogRepository();

            Assert.AreEqual(5, rep.GetProducts()
                            .WithCategory(11)
                            .Count());
        }
コード例 #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());
        }
コード例 #3
0
        public void CatalogRepository_Has_Category_Filter_ForProducts()
        {
            ICatalogRepository rep = new TestCatalogRepository();

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

            Assert.IsNotNull(prod);
        }
コード例 #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());
        }
コード例 #5
0
        public void CatalogRepository_Contains_Products()
        {
            ICatalogRepository r = new TestCatalogRepository();

            Assert.IsNotNull(r.GetProducts());
        }
コード例 #6
0
        public void Setup()
        {
            ICatalogRepository rep = new TestCatalogRepository();

            catalogService = new CatalogService(rep);
        }
コード例 #7
0
        public void CatalogRepository_Repository_Is_Not_Null()
        {
            ICatalogRepository rep = new TestCatalogRepository();

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