public void BasicGeocoding_LoadTest()
        {
            BasicGeocodingSyndicationExtension target = new BasicGeocodingSyndicationExtension();             // TODO: Initialize to an appropriate value
            var nt     = new NameTable();
            var ns     = new XmlNamespaceManager(nt);
            var xpc    = new XmlParserContext(nt, ns, "US-en", XmlSpace.Default);
            var strXml = ExtensionTestUtil.GetWrappedXml(namespc, strExtXml);

            using (XmlReader reader = new XmlTextReader(strXml, XmlNodeType.Document, xpc))
            {
#if false
                //var document  = new XPathDocument(reader);
                //var nav = document.CreateNavigator();
                //nav.Select("//item");
                do
                {
                    if (!reader.Read())
                    {
                        break;
                    }
                } while (reader.NodeType != XmlNodeType.EndElement || reader.Name != "webMaster");


                bool expected = true;
                bool actual;
                actual = target.Load(reader);
                Assert.AreEqual(expected, actual);
#else
                RssFeed feed = new RssFeed();
                feed.Load(reader);
#endif
            }
        }
示例#2
0
        public void AtomPublishingControl_CreateXmlTest()
        {
            var    itunes   = CreateExtension1();
            var    actual   = ExtensionTestUtil.AddExtensionToXml(itunes).Trim();
            string expected = ExtensionTestUtil.GetWrappedXml(namespc, strExtXml).Trim();

            Assert.AreEqual(expected, actual);
        }
        public void FeedRank_CreateXmlTest()
        {
            var re = CreateExtension1();

            var    actual   = ExtensionTestUtil.AddExtensionToXml(re);
            string expected = ExtensionTestUtil.GetWrappedXml(namespc, strExtXml);

            Assert.AreEqual(expected, actual);
        }
        public void CreativeCommons_CreateXmlTest()
        {
            var itunes = CreateExtension1();

            var    actual   = ExtensionTestUtil.AddExtensionToXml(itunes);
            string expected = ExtensionTestUtil.GetWrappedXml(namespc, strExtXml);

            Assert.AreEqual(expected, actual);
        }
示例#5
0
        public void DublinCoreElementSet_CreateXmlTest()
        {
            var dub = CreateExtension1();

            var    actual   = ExtensionTestUtil.AddExtensionToXml(dub);
            string expected = ExtensionTestUtil.GetWrappedXml(namespc, strExtXml);

            Assert.AreEqual(expected, actual);
        }
        public void BasicGeocoding_CreateXmlTest()
        {
            var geo = new BasicGeocodingSyndicationExtension();

            geo.Context.Latitude  = 41.0m;
            geo.Context.Longitude = -74.12m;

            var    actual   = ExtensionTestUtil.AddExtensionToXml(geo);
            string expected = ExtensionTestUtil.GetWrappedXml(namespc, strExtXml);

            Assert.AreEqual(expected, actual);
        }
示例#7
0
        public void Pheed_CreateXmlTest()
        {
            var pheed = new PheedSyndicationExtension();

            pheed.Context.Source    = new Uri("http://www.example.com");
            pheed.Context.Thumbnail = new Uri("http://www.example.com/thumbnail.jpg");

            var    actual   = ExtensionTestUtil.AddExtensionToXml(pheed);
            string expected = ExtensionTestUtil.GetWrappedXml(namespc, strExtXml);

            Assert.AreEqual(expected, actual);
        }
示例#8
0
        public void ITunes_LoadTest()
        {
            ITunesSyndicationExtension target = new ITunesSyndicationExtension(); // TODO: Initialize to an appropriate value
            var nt     = new NameTable();
            var ns     = new XmlNamespaceManager(nt);
            var xpc    = new XmlParserContext(nt, ns, "US-en", XmlSpace.Default);
            var strXml = ExtensionTestUtil.GetWrappedXml(namespc, strExtXml);

            using (XmlReader reader = new XmlTextReader(strXml, XmlNodeType.Document, xpc))
            {
                RssFeed feed = new RssFeed();
                feed.Load(reader);
            }
        }
示例#9
0
        public void AtomPublishingControl_FullTest()
        {
            var strXml = ExtensionTestUtil.GetWrappedXml(namespc, strExtXml);

            using (XmlReader reader = new XmlTextReader(strXml, XmlNodeType.Document, null))
            {
                RssFeed feed = new RssFeed();
                feed.Load(reader);
                Assert.AreEqual(1, feed.Channel.Items.Count());
                var item = feed.Channel.Items.Single();
                var ext  = item.HasExtensions;
                Assert.IsTrue(item.HasExtensions);
                var itemExtension = item.FindExtension <AtomPublishingControlSyndicationExtension>();
                Assert.IsNotNull(itemExtension);
                Assert.IsInstanceOfType(item.FindExtension(AtomPublishingControlSyndicationExtension.MatchByType) as AtomPublishingControlSyndicationExtension,
                                        typeof(AtomPublishingControlSyndicationExtension));
            }
        }