GetActiveCategories() public method

public GetActiveCategories ( ) : IList
return IList
Ejemplo n.º 1
0
        public void CanGetActiveCategories()
        {
            UnitTestHelper.SetupBlog();
            var repository = new DatabaseObjectProvider();
            int[] categoryIds = CreateSomeLinkCategories(repository);
            CreateLink(repository, "Link one", categoryIds[0], null);
            CreateLink(repository, "Link two", categoryIds[0], null);
            CreateLink(repository, "Link one-two", categoryIds[1], null);

            ICollection<LinkCategory> linkCollections = repository.GetActiveCategories();

            //Test ordering by title
            Assert.AreEqual("Google Blogs", linkCollections.First().Title);
            Assert.AreEqual("My Favorite Feeds", linkCollections.ElementAt(1).Title);

            //Check link counts
            Assert.AreEqual(1, linkCollections.First().Links.Count);
            Assert.AreEqual(2, linkCollections.ElementAt(1).Links.Count);
        }