Exemple #1
0
        public void AddParentCategoriesMethodTest()
        {
            // TODO:

            Category category1 = new Category {
                Id = "1111111", Name = "Category 1"
            };
            Category category2 = new Category {
                Id = "2222222", Name = "Category 2"
            };
            Category category3 = new Category {
                Id = "3333333", Name = "Category 3"
            };

            using (var bc = new BusinessContext()) {
                bc.AddNewCategory(category1);
                bc.AddNewCategory(category2);
                bc.AddNewCategory(category3);

                bc.AddParentCategory(category1, category2);

                Assert.IsTrue(category1.CategoryParent == category2);
                Assert.IsTrue(category2.CategoryChild == category1);


                //Category rootCategory = bc.GetRootCategory();

                //Assert.IsTrue (rootCategory == category3);

                //ICollection<Category> childCategories = (ICollection<Category>)bc.GetChildrenCategories(rootCategory);

                //Assert.IsTrue(childCategories.Contains (category2));

                //childCategories = (ICollection<Category>)bc.GetChildrenCategories (category2);

                //Assert.IsTrue (childCategories.Contains (category1));
            }
        }