예제 #1
0
        public void DeleteOutgoingLinks()
        {
            ISettingsStorageProviderV30 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 DeleteOutgoingLinks_InvalidPage_ShouldThrowArgumentException(string p)
        {
            Assert.Throws <ArgumentException>(() =>
            {
                ISettingsStorageProviderV30 prov = GetProvider();

                prov.DeleteOutgoingLinks(p);
            });
        }
예제 #3
0
        public void DeleteOutgoingLinks_InvalidPage(string p)
        {
            ISettingsStorageProviderV30 prov = GetProvider();

            prov.DeleteOutgoingLinks(p);
        }