public void Set_FeedlySubscribers_To_Zero_When_FeedlyInquisitor_Throws_Exception() { FeedlyInquisitor.Arrange(fi => fi.GetSubscriberCount(null)).Throws(new InvalidOperationException()); TargetBlogs.First().FeedlyUrl = null; var blogMetrics = Target.GenerateMetrics(TargetBlogs); blogMetrics.First().FeedlySubscribers.ShouldBe(0); }
public void Fetch_Subscriber_Count_From_FeedlyInquisitor_Using_Blogs_Feedly_Url() { const int feedlySubscriberCount = 200; FeedlyInquisitor.Arrange(fi => fi.GetSubscriberCount(TargetBlog.FeedlyUrl)).Returns(feedlySubscriberCount); var blogMetrics = Target.GenerateMetrics(TargetBlogs); blogMetrics.First().FeedlySubscribers.ShouldBe(feedlySubscriberCount); }
public static void RecordMetrics() { var webClient = new SimpleWebClient(); var feedlyInquisitor = new FeedlyInquisitor(webClient); var alexaInquisitor = new AlexaDataInquisitor(webClient); var mozInquisitor = new MozInquisitor(new CredentialStore(File.ReadAllText(@"CredFiles\moz.cred")), webClient) { Timeout = 10 }; var metricsRecorder = new BlogMetricsRecorder(feedlyInquisitor, alexaInquisitor, mozInquisitor); using (var context = new BlogContext()) { var blogs = context.Blogs.ToList(); var blogMetrics = metricsRecorder.GenerateMetrics(blogs); context.BlogMetrics.AddRange(blogMetrics); context.SaveChanges(); } }
public void BeforeEachTest() { Client.Arrange(c => c.GetRawResultOfBasicGetRequest("http://cloud.feedly.com/v3/feeds/feed%2Fhttp%3A%2F%2Fwww.daedtech.com%2Ffeed")).Returns("{\"iconUrl\":\"https://storage.googleapis.com/site-assets/V7PyrZNy_9OWWjQxM3FiFuemnkUD-4PXYw33r-WuSPM_icon-15d5ed346c5\",\"visualUrl\":\"https://storage.googleapis.com/site-assets/V7PyrZNy_9OWWjQxM3FiFuemnkUD-4PXYw33r-WuSPM_visual-15d5ed346c5\",\"coverUrl\":\"https://storage.googleapis.com/site-assets/V7PyrZNy_9OWWjQxM3FiFuemnkUD-4PXYw33r-WuSPM_cover-15d5ed346c5\",\"id\":\"feed/http://www.daedtech.com/feed\",\"feedId\":\"feed/http://www.daedtech.com/feed\",\"title\":\"DaedTech\",\"subscribers\":1884,\"updated\":1516330626191,\"velocity\":2.3,\"website\":\"https://www.daedtech.com\",\"topics\":[\"programming\",\"tech\",\"development\",\"dev\"],\"partial\":false,\"language\":\"en\",\"contentType\":\"longform\",\"description\":\"DaedTech LLC: programming, architecture, IT management consulting, and blogging.\",\"coverColor\":\"131516\"}"); Target = new FeedlyInquisitor(Client); }