Exemplo n.º 1
0
        public void TestRdfFeedItems()
        {
            SubscriptionList sl  = new SubscriptionList();
            WebSubscription  sub = new WebSubscription()
            {
                Parent = sl
            };

            sub.Load();
            Dictionary <string, int> propertyChanges = DetectSubscriptionChanges(sub);

            using (FileStream fs = new FileStream("rss-rdf-sample.xml", FileMode.Open)) {
                sub.UpdateFromStreamReader(new StreamReader(fs), SynchronousDispatch, RejectError);
            }
            ValidateRdf(sub);
        }
Exemplo n.º 2
0
        public void TestAtomFeedDetails()
        {
            SubscriptionList sl  = new SubscriptionList();
            WebSubscription  sub = new WebSubscription()
            {
                Parent = sl
            };

            sub.Load();
            Dictionary <string, int> propertyChanges = DetectSubscriptionChanges(sub);

            using (FileStream fs = new FileStream("atomsample.xml", FileMode.Open)) {
                sub.UpdateFromStreamReader(new StreamReader(fs), SynchronousDispatch, RejectError);
            }
            Assert.AreEqual(1, propertyChanges["Title"]);
            Assert.AreEqual(1, propertyChanges["PublicURI"]);
            Assert.AreEqual("Example Feed", sub.Title);
            Assert.AreEqual("http://example.org/", sub.PublicURI);
        }
Exemplo n.º 3
0
        public void TestAtomFeedSerialization()
        {
            SubscriptionList sl  = new SubscriptionList();
            WebSubscription  sub = new WebSubscription()
            {
                Parent = sl
            };

            sub.Load();
            using (FileStream fs = new FileStream("atomsample.xml", FileMode.Open)) {
                sub.UpdateFromStreamReader(new StreamReader(fs), SynchronousDispatch, RejectError);
            }
            foreach (KeyValuePair <string, Entry> kvp in sub.Entries)
            {
                if (kvp.Value.Serial % 2 == 1)
                {
                    kvp.Value.Read = true;
                }
            }
            sub.Save("data.xml");

            WebSubscription sub2 = new WebSubscription()
            {
                Parent = sl
            };
            Dictionary <string, int> propertyChanges = DetectSubscriptionChanges(sub2);

            sub2.Load("data.xml");
            Assert.AreEqual(1, propertyChanges["Entries"]);
            ValidateAtom(sub2);
            foreach (KeyValuePair <string, Entry> kvp in sub2.Entries)
            {
                if (kvp.Value.Serial % 2 == 1)
                {
                    Assert.AreEqual(true, kvp.Value.Read);
                }
                else
                {
                    Assert.AreEqual(false, kvp.Value.Read);
                }
            }
        }
Exemplo n.º 4
0
        public void TestRdfFeedDetails()
        {
            SubscriptionList sl  = new SubscriptionList();
            WebSubscription  sub = new WebSubscription()
            {
                Parent = sl
            };

            sub.Load();
            Dictionary <string, int> propertyChanges = DetectSubscriptionChanges(sub);

            using (FileStream fs = new FileStream("rss-rdf-sample.xml", FileMode.Open)) {
                sub.UpdateFromStreamReader(new StreamReader(fs), SynchronousDispatch, RejectError);
            }
            Assert.AreEqual(1, propertyChanges["Title"]);
            Assert.AreEqual(1, propertyChanges["PublicURI"]);
            Assert.AreEqual(1, propertyChanges["Description"]);
            Assert.AreEqual("LWN.net", sub.Title);
            Assert.AreEqual("http://lwn.net", sub.PublicURI);
            Assert.AreEqual("\n LWN.net is a ...\n    ", sub.Description);
        }
Exemplo n.º 5
0
        public void TestRssFeedDetails()
        {
            SubscriptionList sl  = new SubscriptionList();
            WebSubscription  sub = new WebSubscription()
            {
                Parent = sl
            };

            sub.Load();
            Dictionary <string, int> propertyChanges = DetectSubscriptionChanges(sub);

            using (FileStream fs = new FileStream("rss2sample.xml", FileMode.Open)) {
                sub.UpdateFromStreamReader(new StreamReader(fs), SynchronousDispatch, RejectError);
            }
            Assert.AreEqual(1, propertyChanges["Title"]);
            Assert.AreEqual(1, propertyChanges["PublicURI"]);
            Assert.AreEqual(1, propertyChanges["Description"]);
            Assert.AreEqual("Liftoff News", sub.Title);
            Assert.AreEqual("http://liftoff.msfc.nasa.gov/", sub.PublicURI);
            Assert.AreEqual("Liftoff to Space Exploration.", sub.Description);
        }