public void DeleteOutgoingLinks() { ISettingsStorageProviderV40 prov = GetProvider(); prov.StoreOutgoingLinks("Page1", new string[] { "Page2", "Page3", "Page100" }); prov.StoreOutgoingLinks("Page2", new string[] { "Page4", "Page5", "Page6" }); prov.StoreOutgoingLinks("Page3", new string[] { "Page1", "Page6" }); Assert.IsFalse(prov.DeleteOutgoingLinks("Page21"), "DeleteOutgoingLinks should return false"); Assert.IsTrue(prov.DeleteOutgoingLinks("Page100"), "DeleteOutgoingLinks should return true"); Assert.IsTrue(prov.DeleteOutgoingLinks("Page1"), "DeleteOutgoingLinks should return true"); Assert.AreEqual(0, prov.GetOutgoingLinks("Page1").Length, "Links not deleted"); Assert.AreEqual(3, prov.GetOutgoingLinks("Page2").Length, "Wrong link count"); Assert.AreEqual(1, prov.GetOutgoingLinks("Page3").Length, "Wrong link count"); IDictionary <string, string[]> links = prov.GetAllOutgoingLinks(); Assert.AreEqual(2, links.Count, "Wrong source page count"); Assert.AreEqual(3, links["Page2"].Length, "Wrong link count"); Array.Sort(links["Page2"]); Assert.AreEqual("Page4", links["Page2"][0], "Wrong link"); Assert.AreEqual("Page5", links["Page2"][1], "Wrong link"); Assert.AreEqual("Page6", links["Page2"][2], "Wrong link"); Assert.AreEqual(1, links["Page3"].Length, "Wrong link count"); Assert.AreEqual("Page6", links["Page3"][0], "Wrong link"); }
public void UpdateOutgoingLinksForRename() { ISettingsStorageProviderV40 prov = GetProvider(); prov.StoreOutgoingLinks("Page1", new string[] { "Page2", "OldPage" }); prov.StoreOutgoingLinks("Page2", new string[] { "Page4", "Page5", "Page6" }); prov.StoreOutgoingLinks("OldPage", new string[] { "Page2", "Page5" }); Assert.IsFalse(prov.UpdateOutgoingLinksForRename("Inexistent", "NewName"), "UpdateOutgoingLinksForRename should return false"); Assert.IsTrue(prov.UpdateOutgoingLinksForRename("OldPage", "Page3"), "UpdateOutgoingLinksForRename should return true"); IDictionary <string, string[]> links = prov.GetAllOutgoingLinks(); Assert.AreEqual(3, links.Count, "Wrong source page count"); Assert.AreEqual(2, links["Page1"].Length, "Wrong link count"); Array.Sort(links["Page1"]); Assert.AreEqual("Page2", links["Page1"][0], "Wrong link"); Assert.AreEqual("Page3", links["Page1"][1], "Wrong link"); Assert.AreEqual(3, links["Page2"].Length, "Wrong link count"); Array.Sort(links["Page2"]); Assert.AreEqual("Page4", links["Page2"][0], "Wrong link"); Assert.AreEqual("Page5", links["Page2"][1], "Wrong link"); Assert.AreEqual("Page6", links["Page2"][2], "Wrong link"); Assert.AreEqual(2, links["Page3"].Length, "Wrong link count"); Array.Sort(links["Page3"]); Assert.AreEqual("Page2", links["Page3"][0], "Wrong link"); Assert.AreEqual("Page5", links["Page3"][1], "Wrong link"); }
public void GetAllOutgoingLinks() { ISettingsStorageProviderV40 prov = GetProvider(); prov.StoreOutgoingLinks("Page1", new string[] { "Page2", "Page3" }); prov.StoreOutgoingLinks("Page2", new string[] { "Page4", "Page5", "Page6" }); prov.StoreOutgoingLinks("Page3", new string[] { "Page2", "Page5" }); IDictionary <string, string[]> links = prov.GetAllOutgoingLinks(); Assert.AreEqual(3, links.Count, "Wrong source page count"); Assert.AreEqual(2, links["Page1"].Length, "Wrong link count"); Array.Sort(links["Page1"]); Assert.AreEqual("Page2", links["Page1"][0], "Wrong link"); Assert.AreEqual("Page3", links["Page1"][1], "Wrong link"); Assert.AreEqual(3, links["Page2"].Length, "Wrong link count"); Array.Sort(links["Page2"]); Assert.AreEqual("Page4", links["Page2"][0], "Wrong link"); Assert.AreEqual("Page5", links["Page2"][1], "Wrong link"); Assert.AreEqual("Page6", links["Page2"][2], "Wrong link"); Assert.AreEqual(2, links["Page3"].Length, "Wrong link count"); Array.Sort(links["Page3"]); Assert.AreEqual("Page2", links["Page3"][0], "Wrong link"); Assert.AreEqual("Page5", links["Page3"][1], "Wrong link"); }