Пример #1
0
        public void DeleteCategory()
        {
            //Deleting Empty Category:
            var cc   = CreateCategory(null, "Delete test");
            var res4 = _api.DeleteCategory(cc.Id);

            Assert.IsNotNull(res4);
            Assert.AreEqual(ResultState.Deleted, res4);

            //Deleting not existing category:
            var res = _api.DeleteCategory(9846774);

            Assert.IsNotNull(res);
            Assert.AreEqual(ResultState.Error, res);

            //Deleting category with subcategories
            var cc1  = CreateCategory(null, "Delete test ROOT");
            var cc2  = CreateCategory(cc1.Id, "Delete test SUB");
            var res2 = _api.DeleteCategory(cc1.Id);

            Assert.IsNotNull(res2);
            Assert.AreEqual(ResultState.Deleted, res2);


            //Deleting Category with topics:
            var cct   = CreateCategory(null, "Delete test Topic");
            var topic = CreateTopic(cct.Id);
            var res3  = _api.DeleteCategory(23);

            Assert.IsNotNull(res3);
            Assert.AreEqual(ResultState.Deleted, res3);
        }