public void BasicGeocodingSyndicationExtensionConstructorTest()
        {
            BasicGeocodingSyndicationExtension target = new BasicGeocodingSyndicationExtension();

            Assert.IsNotNull(target);
            Assert.IsInstanceOfType(target, typeof(BasicGeocodingSyndicationExtension));
        }
        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
            }
        }
        /// <summary>
        /// Provides example code for the BasicGeocodingSyndicationExtension class.
        /// </summary>
        public static void ClassExample()
        {
            // Framework auto-discovers supported extensions based on XML namespace attributes (xmlns) defined on root of resource
            RssFeed feed = RssFeed.Create(new Uri("http://www.example.com/feed.aspx?format=rss"));

            // Extensible framework entities provide properties/methods to determine if entity is extended and predicate based seaching against available extensions
            if (feed.Channel.HasExtensions)
            {
                BasicGeocodingSyndicationExtension channelExtension = feed.Channel.FindExtension(BasicGeocodingSyndicationExtension.MatchByType) as BasicGeocodingSyndicationExtension;
                if (channelExtension != null)
                {
                    // Process channel extension
                }
            }

            foreach (RssItem item in feed.Channel.Items)
            {
                if (item.HasExtensions)
                {
                    BasicGeocodingSyndicationExtension itemExtension = item.FindExtension(BasicGeocodingSyndicationExtension.MatchByType) as BasicGeocodingSyndicationExtension;
                    if (itemExtension != null)
                    {
                        // Process extension for current item
                    }
                }
            }

            // By default the framework will automatically determine what XML namespace attributes (xmlns) to write
            // on the root of the resource based on the extensions applied to extensible parent and child entities
            using (FileStream stream = new FileStream("Feed.xml", FileMode.Create, FileAccess.Write))
            {
                feed.Save(stream);
            }
        }
        private BasicGeocodingSyndicationExtension CreateExtension2()
        {
            var nyc = new BasicGeocodingSyndicationExtension();

            nyc.Context.Latitude  = 43;
            nyc.Context.Longitude = -80;
            return(nyc);
        }
        public void BasicGeocoding_MatchByTypeTest()
        {
            ISyndicationExtension extension = CreateExtension1();
            bool expected = true;
            bool actual;

            actual = BasicGeocodingSyndicationExtension.MatchByType(extension);
            Assert.AreEqual(expected, actual);
        }
        public void ConvertDegreesMinutesSecondsToDecimalTest()
        {
            string  degreesMinutesSeconds = "12°34'56.78\"";
            Decimal expected = new Decimal(12.582438888888888888888888888889);
            Decimal actual;

            actual = BasicGeocodingSyndicationExtension.ConvertDegreesMinutesSecondsToDecimal(degreesMinutesSeconds);
            Assert.AreEqual((double)expected, (double)actual, 3e-6);
        }
        public void BasicGeocoding_op_InequalityTest()
        {
            BasicGeocodingSyndicationExtension first  = CreateExtension1();
            BasicGeocodingSyndicationExtension second = CreateExtension2();
            bool expected = true;
            bool actual   = (first != second);

            Assert.AreEqual(expected, actual);
        }
        public void BasicGeocoding_ConvertDecimalToDegreesMinutesSecondsTest()
        {
            Decimal value    = new Decimal(12.582438888888888888888888888889);
            string  expected = "12°34'56.78\"";
            string  actual;

            actual = BasicGeocodingSyndicationExtension.ConvertDecimalToDegreesMinutesSeconds(value);
            Assert.AreEqual(expected, actual);
        }
        public void BasicGeocoding_ToStringTest()
        {
            BasicGeocodingSyndicationExtension target = CreateExtension1();
            string expected = nycText;
            string actual;

            actual = target.ToString();
            Assert.AreEqual(expected, actual);
        }
        public void BasicGeocoding_GetHashCodeTest()
        {
            BasicGeocodingSyndicationExtension target = CreateExtension1();
            int expected = -1112179344;
            int actual;

            actual = target.GetHashCode();
            Assert.AreEqual(expected, actual);
        }
        // Get BasicGeo extension data
        private void SetBasicGeocodingExtension(AdvancedRssItem RssItemSource, RssItem RssItemDest)
        {
            BasicGeocodingSyndicationExtension GeoCoding = new BasicGeocodingSyndicationExtension();

            GeoCoding.Context.Longitude = (decimal)RssItemSource.Geolon;
            GeoCoding.Context.Latitude  = (decimal)RssItemSource.Geolon;

            RssItemDest.AddExtension(GeoCoding);
        }
        public void BasicGeocoding_op_EqualityTest_Failure()
        {
            BasicGeocodingSyndicationExtension first  = CreateExtension1();
            BasicGeocodingSyndicationExtension second = CreateExtension2();
            bool expected = false;
            bool actual;

            actual = (first == second);
            Assert.AreEqual(expected, actual);
        }
        public void BasicGeocoding_op_GreaterThanTest()
        {
            BasicGeocodingSyndicationExtension first  = CreateExtension1();
            BasicGeocodingSyndicationExtension second = CreateExtension2();
            bool expected = false;
            bool actual   = false;

            actual = (first > second);
            Assert.AreEqual(expected, actual);
        }
        public void BasicGeocoding_CompareToTest()
        {
            BasicGeocodingSyndicationExtension target = CreateExtension1();
            object obj      = CreateExtension1();
            int    expected = 0;
            int    actual;

            actual = target.CompareTo(obj);
            Assert.AreEqual(expected, actual);
        }
        public void BasicGeocoding_EqualsTest()
        {
            BasicGeocodingSyndicationExtension target = CreateExtension1();
            object obj      = CreateExtension1();
            bool   expected = true;
            bool   actual;

            actual = target.Equals(obj);
            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);
        }
        public void BasicGeocoding_WriteToTest()
        {
            BasicGeocodingSyndicationExtension target = CreateExtension1();

            using (var sw = new StringWriter())
                using (XmlWriter writer = new XmlTextWriter(sw))
                {
                    target.WriteTo(writer);
                    var output = sw.ToString();
                    Assert.AreEqual(nycText.Replace(Environment.NewLine, ""), output.Replace(Environment.NewLine, ""));
                }
        }
        public void BasicGeocoding_ContextTest()
        {
            BasicGeocodingSyndicationExtension        target   = CreateExtension1();
            BasicGeocodingSyndicationExtensionContext expected = CreateContext1();
            BasicGeocodingSyndicationExtensionContext actual;

//			target.Context = expected;
            actual = target.Context;
            var b = actual.Equals(expected);

            Assert.AreEqual(expected, actual);
            Assert.Inconclusive("Verify the correctness of this test method.");
        }
 public void BasicGeocodingSyndicationExtensionConstructorTest()
 {
     BasicGeocodingSyndicationExtension target = new BasicGeocodingSyndicationExtension();
     Assert.IsNotNull(target);
     Assert.IsInstanceOfType(target, typeof(BasicGeocodingSyndicationExtension));
 }
 private BasicGeocodingSyndicationExtension CreateExtension2()
 {
     var nyc = new BasicGeocodingSyndicationExtension();
     nyc.Context.Latitude = 43;
     nyc.Context.Longitude = -80;
     return nyc;
 }
        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);
        }
        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
            }
        }
        private AdvancedRssChannel GetRssChannelFromRss(Uri url)
        {
            AdvancedRssChannel Channel = new AdvancedRssChannel();

            //Argotic object declaration
            RssFeed ArgoticRssFeed = new RssFeed();

            //Load from uri
            try
            {
                ArgoticRssFeed.Load(url, null, null);
            }
            catch
            {
            }

            //Init Channel basic data
            GetBasicChannelData(ArgoticRssFeed.Channel, Channel);

            //Init data for each item
            foreach (RssItem item in ArgoticRssFeed.Channel.Items)
            {
                //Init basic data
                AdvancedRssItem RssItem = new AdvancedRssItem();
                GetBasicItemData(item, RssItem);

                //Extensions type content
                if (item.HasExtensions)
                {
                    //Dublin Core Extension
                    DublinCoreMetadataTermsSyndicationExtension BublinExtension =
                        (DublinCoreMetadataTermsSyndicationExtension)
                        item.FindExtension(DublinCoreMetadataTermsSyndicationExtension.MatchByType);
                    if (BublinExtension != null)
                    {
                        GetDublinCoreExtension(BublinExtension.Context, RssItem);
                    }

                    //Dublin Extension
                    DublinCoreMetadataTermsSyndicationExtension DublinExtension =
                        (DublinCoreMetadataTermsSyndicationExtension)
                        item.FindExtension(DublinCoreMetadataTermsSyndicationExtension.MatchByType);
                    if (DublinExtension != null)
                    {
                        GetDublinCoreExtension(DublinExtension.Context, RssItem);
                    }

                    //Slash Extension
                    SiteSummarySlashSyndicationExtension SlashExtension =
                        (SiteSummarySlashSyndicationExtension)
                        item.FindExtension(SiteSummarySlashSyndicationExtension.MatchByType);
                    if (SlashExtension != null)
                    {
                        GetSlashCoreExtension(SlashExtension.Context, RssItem);

                        /*-----------------------------------------------------------------------------------*/
                        /* TODO: Comment problem                                                             */
                        /* Arrangment for a stupid argotic buc, they wrote "coment" and no "comment" !!!!!!  */
                        /* The news module comment URL, it's the URL + #comments                             */
                        /*-----------------------------------------------------------------------------------*/
                        if (SlashExtension.Context.Comments >= 0 && RssItem.Commenturl == null)
                        {
                            RssItem.Commenturl = item.Link.AbsoluteUri + "#comments";
                        }
                        /*-----------------------------------------------------------------------------------*/
                    }

                    //Geo localization
                    BasicGeocodingSyndicationExtension GMLExtension =
                        (BasicGeocodingSyndicationExtension)
                        item.FindExtension(BasicGeocodingSyndicationExtension.MatchByType);
                    if (GMLExtension != null)
                    {
                        GetBasicGeocodingExtension(GMLExtension.Context, RssItem);
                    }

                    ////Yahoo media tag
                    YahooMediaSyndicationExtension YahooExtension =
                        (YahooMediaSyndicationExtension)item.FindExtension(YahooMediaSyndicationExtension.MatchByType);
                    if (YahooExtension != null)
                    {
                        RssItem.RssfeedItemsMedia = new List <AdvancedRssItemMedia>();
                        GetYahooExtension(YahooExtension.Context, RssItem.RssfeedItemsMedia);
                    }
                }

                Channel.RssItems.Add(RssItem);
            }

            return(Channel);
        }