示例#1
0
        public void CanCreateAndDeleteLinkCategory()
        {
            UnitTestHelper.SetupBlog();
            var repository = new DatabaseObjectProvider();

            // Create some categories
            int categoryId =
                repository.CreateLinkCategory(CreateCategory("My Favorite Feeds", "Some of my favorite RSS feeds",
                                                             CategoryType.LinkCollection, true));

            LinkCategory category = repository.GetLinkCategory(categoryId, true);

            Assert.AreEqual(Config.CurrentBlog.Id, category.BlogId);
            Assert.AreEqual("My Favorite Feeds", category.Title);
            Assert.AreEqual("Some of my favorite RSS feeds", category.Description);
            Assert.IsTrue(category.HasDescription);
            Assert.IsFalse(category.HasLinks);
            Assert.IsFalse(category.HasImages);
            Assert.IsTrue(category.IsActive);
            Assert.AreEqual(CategoryType.LinkCollection, category.CategoryType);
            Assert.IsNotNull(category);

            repository.DeleteLinkCategory(categoryId);
            Assert.IsNull(repository.GetLinkCategory(categoryId, true));
        }