Exemple #1
0
 public void LoadFromXML()
 {
     var opml = new Opml();
     opml.LoadFromXML(_sampleOPML);
     Trace.WriteLine("Hello " + opml.Title);
     Assert.IsNotNull(opml.Title);
     Assert.IsTrue(opml.Title == "mySubscriptions.opml");
     Assert.IsTrue(opml.OwnerEmail == "*****@*****.**");
     Assert.IsTrue(opml.Outlines.Count > 0, "Outlines must be greater than zero");
 }
        public void TestSyndicationFetcher()
        {
            var opml = new Opml();
            opml.LoadFromXML(_sampleOPML);
            var subscription = new RssSubscription(opml);

            var fetcher = new SyndicationFetcher();

            var feeds = fetcher.DownloadAll(subscription);

            Assert.IsTrue(feeds.Count > 0, "All downloads must be bigger than zero");
        }
        public ActionResult Index(string url)
        {
            var uri = new Uri(url);
            var subFetcher = new SubscriptionFetcher();
            var xml = subFetcher.Download(Texts.FromUriHost(uri), uri.PathAndQuery);
            var opml = new Opml();
            opml.LoadFromXML(xml);
            var subscription = new RssSubscription(opml);

            var fetcher = new SyndicationFetcher();
            var feeds = fetcher.DownloadAll(subscription);

            return Content("Feeds " + feeds.Count);
        }
        public void LoadFromOPML()
        {
            var opml = new Opml();
            var res = opml.LoadFromXML(_sample);
            Assert.IsTrue(res.IsTrue, "OPML loading must be true, not " + res.Message);

            var subscription = new RiverSubscription(opml);

            Assert.IsTrue(subscription.Items.Count > 0, "River must contains items");

            Assert.IsTrue(subscription.Items.Count > 0);
            var item1 = subscription.Items.First();
            Assert.IsNotNullOrEmpty(item1.Text);
            //            Assert.IsNotNullOrEmpty(item1.Name); //depending on sample data
            //            Assert.IsNotNullOrEmpty(item1.Description); //depending on sample data
            Assert.IsNotNullOrEmpty(item1.JSONPUri.ToString());
        }
        public void SaveSyndicationList()
        {
            var syndication = new SyndicationList();
            syndication.Id = SyndicationList.NewId("dodyg").Full();
            syndication.Guid = Stamp.GUID().ToString();
            syndication.Name = "dodyg";
            syndication.Title = "Dody's Syndication Wall";
            syndication.Description = "Amazing Wall";
            syndication.Keywords = "dody, syndication";
            var opml = new Opml();
            opml.LoadFromXML(_sampleOPML);
            syndication.Sources = new RssSubscription(opml);

            using (var store = Raven.GetStoreFromServer())
            {
                using (var session = store.OpenSession(Raven.DATABASE_NAME))
                {
                    session.Store(syndication);
                    session.SaveChanges();
                }
            }
        }
Exemple #6
0
        public IQuerySetOne<RiverSubscription> FetchDefaultRivers()
        {
            string cacheKey = "DEFAULT_RIVERS";
            var cache = HttpContext.Cache[cacheKey] as RiverSubscription;

            if (cache != null)
            {
                return new QuerySetOne<RiverSubscription>(cache);
            }
            else
            {
                var fetcher = new SubscriptionFetcher();
            #if DEBUG
                var xml = fetcher.Download(Texts.FromUriHost(Request.Url), "api/1/default/RiversSubscription");
            #else
                var xml = fetcher.Download("http://hobihobi.apphb.com", "api/1/default/RiversSubscription");
            #endif
                var opml = new Opml();
                var res = opml.LoadFromXML(xml);

                if (res.IsTrue)
                {
                    var subscriptionList = new RiverSubscription(opml);
                    HttpContext.Cache.Add(cacheKey, subscriptionList, null, Cache.NoAbsoluteExpiration, new TimeSpan(0, 10, 0), CacheItemPriority.Default, null);

                    return new QuerySetOne<RiverSubscription>(subscriptionList);
                }
                else
                {
                    return new QuerySetOne<RiverSubscription>(null);
                }
            }
        }
        public void LoadFromOPML()
        {
            var opml = new Opml();
            opml.LoadFromXML(_sample);
            var subscription = new RssSubscription(opml);

            Assert.IsTrue(subscription.Items.Count > 0);
            var item1 = subscription.Items.First();
            Assert.IsNotNullOrEmpty(item1.Title);
            Assert.IsNotNullOrEmpty(item1.Text);
            Assert.IsNotNullOrEmpty(item1.Name);
            Assert.IsNotNullOrEmpty(item1.Description);
            Assert.IsNotNullOrEmpty(item1.HtmlUri.ToString());
            Assert.IsNotNullOrEmpty(item1.XmlUri.ToString());
        }