public void CanGetCategoriesByPostId() { UnitTestHelper.SetupBlog(); var repository = new DatabaseObjectProvider(); int category1Id = repository.CreateLinkCategory(CreateCategory("Post Category 1", "Cody roolz!", CategoryType.PostCollection, true)); int category2Id = repository.CreateLinkCategory(CreateCategory("Post Category 2", "Cody roolz again!", CategoryType.PostCollection, true)); repository.CreateLinkCategory(CreateCategory("Post Category 3", "Cody roolz and again!", CategoryType.PostCollection, true)); Entry entry = UnitTestHelper.CreateEntryInstanceForSyndication("phil", "title", "body"); int entryId = UnitTestHelper.Create(entry); repository.SetEntryCategoryList(entryId, new[] { category1Id, category2Id }); ICollection<LinkCategory> categories = repository.GetLinkCategoriesByPostId(entryId); Assert.AreEqual(2, categories.Count, "Expected two of the three categories"); Assert.AreEqual(category1Id, categories.First().Id); Assert.AreEqual(category2Id, categories.ElementAt(1).Id); Assert.AreEqual(Config.CurrentBlog.Id, categories.First().BlogId); }