Ejemplo n.º 1
0
 /// <summary>
 /// Returns a class that implements IImageProvider based on the string passed, which should come from the provider types.
 /// </summary>
 /// <param name="providerName">A string that maps to an image provider. Should come from the provider types list.</param>
 /// <returns></returns>
 public IImageUrlProvider CreateProvider(string providerName)
 {
     IImageUrlProvider provider;
     switch (providerName)
     {
         case "Reddit":
         default:
             provider = new RedditPage(new Uri("http://www.reddit.com/r/aww"));
             break;
         case "Pinterest":
             provider = new PinterestBoard(new Uri("http://pinterest.com/all/?category=animals"));
             break;
     }
     return provider;
 }
        /// <summary>
        /// Returns a class that implements IImageProvider based on the string passed, which should come from the provider types.
        /// </summary>
        /// <param name="providerName">A string that maps to an image provider. Should come from the provider types list.</param>
        /// <returns></returns>
        public IImageUrlProvider CreateProvider(string providerName)
        {
            IImageUrlProvider provider;

            switch (providerName)
            {
            case "Reddit":
            default:
                provider = new RedditPage(new Uri("http://www.reddit.com/r/aww"));
                break;

            case "Pinterest":
                provider = new PinterestBoard(new Uri("http://pinterest.com/all/?category=animals"));
                break;
            }
            return(provider);
        }
Ejemplo n.º 3
0
        public void PostUrls_Test()
        {
            List<Uri> expected = new List<Uri>
            {
                new Uri("http://i.imgur.com/gzM4d.jpg"),
                new Uri("http://i.imgur.com/RJPpg.jpg"),
                new Uri("http://i.imgur.com/lGlYd.jpg"),
                new Uri("http://imgur.com/eLsOC"),
                new Uri("http://i.imgur.com/ij8aD.jpg?1"),
                new Uri("http://i.imgur.com/chpyk.jpg"),
                new Uri("http://imgur.com/a34aG"),
                new Uri("http://i.imgur.com/bAHVs.jpg"),
                new Uri("http://imgur.com/t1gcK"),
                new Uri("http://imgur.com/ahOMq"),
                new Uri("http://imgur.com/zUtRh"),
                new Uri("http://i.imgur.com/EVsxY.jpg"),
                new Uri("http://i.imgur.com/fDD72.jpg"),
                new Uri("http://i.imgur.com/CTPoN.jpg"),
                new Uri("http://i.imgur.com/CcRhZ.jpg"),
                new Uri("http://i.imgur.com/exLxs.jpg"),
                new Uri("http://www.imgur.com/Uhwxp.jpeg"),
                new Uri("http://imgur.com/R5uRE"),
                new Uri("http://i.imgur.com/Xo9Nv.jpg"),
                new Uri("http://i.imgur.com/BrOi4.jpg"),
                new Uri("http://www.flickr.com/photos/t_funk/7303497392/"),
                new Uri("http://imgur.com/6f1Hs"),
                new Uri("http://imgur.com/nNSpv"),
                new Uri("http://i.imgur.com/sn4DM.jpg"),
                new Uri("http://i.imgur.com/ckfR4.jpg")
            };

            string sampleRedditPageJson = Resources.redditsamplepage;

            var page = new RedditPage(sampleRedditPageJson);
            var actual = page.PostUrls;

            var differenceQuery = expected.Except(actual);
            Assert.AreEqual(differenceQuery.Count(), 0);
        }
Ejemplo n.º 4
0
 public void RedditPage_Integration_Test()
 {
     var page = new RedditPage(new Uri("http://www.reddit.com/r/aww"));
     var actual = page.GetRandomImageUrl();
     Assert.IsTrue(actual.AbsoluteUri.EndsWith(".jpg"));
 }