public void CanCreateAndDeleteLink() { UnitTestHelper.SetupBlog(); var repository = new DatabaseObjectProvider(); int categoryId = repository.CreateLinkCategory(CreateCategory("My Favorite Feeds", "Some of my favorite RSS feeds", CategoryType.LinkCollection, true)); Link link = CreateLink(repository, "Title", categoryId, null); int linkId = link.Id; Link loaded = repository.GetLink(linkId); Assert.AreEqual("Title", loaded.Title); Assert.AreEqual(NullValue.NullInt32, loaded.PostId); Assert.AreEqual(Config.CurrentBlog.Id, loaded.BlogId); repository.DeleteLink(linkId); Assert.IsNull(repository.GetLink(linkId)); }
public void CanUpdateLink() { UnitTestHelper.SetupBlog(); var repository = new DatabaseObjectProvider(); // Create the categories CreateSomeLinkCategories(repository); int categoryId = repository.CreateLinkCategory(CreateCategory("My Favorite Feeds", "Some of my favorite RSS feeds", CategoryType.LinkCollection, true)); Link link = CreateLink(repository, "Test", categoryId, null); int linkId = link.Id; Link loaded = repository.GetLink(linkId); Assert.AreEqual("Test", loaded.Title); Entry entry = UnitTestHelper.CreateEntryInstanceForSyndication("test", "test", "test"); //Make changes then update. link.PostId = entry.Id; link.Title = "Another title"; link.NewWindow = true; repository.UpdateLink(link); loaded = repository.GetLink(linkId); Assert.AreEqual("Another title", loaded.Title); Assert.IsTrue(loaded.NewWindow); Assert.AreEqual(entry.Id, loaded.PostId); }