public void HandleReturnsEmptyListSuccess() { var logger = new Mock <ILogger <GetActiveBlogEntriesHandler> >(); var cachedGitHubEntryProvider = new Mock <ICachedGitHubEntryProvider>(); var handler = new GetActiveBlogEntriesHandler(logger.Object, cachedGitHubEntryProvider.Object); var request = new GetActiveBlogEntriesQuery(); var cancelationToken = new System.Threading.CancellationToken(); var gitHubEntry = new GitHubBlogEntry(); gitHubEntry.SetContent(notActiveContent); var expected = new List <GitHubBlogEntry>(); cachedGitHubEntryProvider.Setup(x => x.GetEntries()).ReturnsAsync(new List <GitHubBlogEntry> { gitHubEntry }); var actual = handler.Handle(request, cancelationToken).Result; Assert.Equal(expected, actual); }
public async Task <IList <GitHubBlogEntry> > Handle(GetActiveBlogEntriesQuery request, CancellationToken cancellationToken) { var entries = await _gitHubEntryProvider.GetEntries(); return(entries.Where(x => x.GitHubBlogEntryMetaData.Live).ToList()); }