public IEnumerable <BlogFeedContent> Read(string sourceFeedUrl, IDictionary filters, Pagination pagination) { var category = ExtractCategory(filters); var feedUrl = new FeedUrl(sourceFeedUrl, category, pagination); var feedResult = _webClient.GetContent(feedUrl.Url); ValidateFeedResult(feedResult); var feedResultAsJson = _jsonParser.Parse <FeedResponseRoot>(feedResult); var blogFeedContent = _blogFeedContentParser.Parse(feedResultAsJson.posts); return(blogFeedContent); }
public void Should_ParsePostList_UsingBlogFeedContentParser() { var posts = GivenAListOfPostObject(); var expected = new List <BlogFeedContent> { new BlogFeedContent .BlogFeedContentBuilder() .WithTitle(SampleTitle) .WithCategories(_sampleCategories) .WithPublishDate(_samplePublishDate) .WithUrl(SampleUrl) .WithSummary(SampleExcerpt) .WithThumbnailImages(_sampleThumbnailImages) .Build() }; var obtained = _blogFeedContentParser.Parse(posts).ToList(); AreEqual(expected, obtained).Should().BeTrue(); }