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 StoreOutgoingLinks_GetOutgoingLinks_EmptyLinks() { ISettingsStorageProviderV40 prov = GetProvider(); Assert.IsTrue(prov.StoreOutgoingLinks("Page", new string[0]), "StoreOutgoingLinks should return true even if outgoingLinks is empty"); Assert.AreEqual(0, prov.GetOutgoingLinks("Page").Length, "Wrong link count"); }
public void StoreOutgoingLinks_GetOutgoingLinks() { ISettingsStorageProviderV40 prov = GetProvider(); Assert.AreEqual(0, prov.GetOutgoingLinks("Page").Length, "Wrong initial link count"); Assert.IsTrue(prov.StoreOutgoingLinks("Page", new string[] { "Page2", "Sub.Page", "Page3" }), "StoreOutgoingLinks should return true"); string[] links = prov.GetOutgoingLinks("Page"); Assert.AreEqual(3, links.Length, "Wrong link count"); Array.Sort(links); Assert.AreEqual("Page2", links[0], "Wrong link"); Assert.AreEqual("Page3", links[1], "Wrong link"); Assert.AreEqual("Sub.Page", links[2], "Wrong link"); }
public void GetOutgoingLinks_InvalidPage(string p) { ISettingsStorageProviderV40 prov = GetProvider(); prov.GetOutgoingLinks(p); }