コード例 #1
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());
        }
コード例 #2
0
        public void CatalogRepository_Repository_Is_Not_Null()
        {
            ICatalogRepository rep = new TestCatalogRepository();

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