GetLinkCategory() public method

Gets the link category for the specified category id.
public GetLinkCategory ( int categoryId, bool activeOnly ) : LinkCategory
categoryId int The category id.
activeOnly bool if set to true [active only].
return Subtext.Framework.Components.LinkCategory
Esempio n. 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));
        }