コード例 #1
0
        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);
        }
コード例 #2
0
        public async Task <IList <GitHubBlogEntry> > Handle(GetActiveBlogEntriesQuery request, CancellationToken cancellationToken)
        {
            var entries = await _gitHubEntryProvider.GetEntries();

            return(entries.Where(x => x.GitHubBlogEntryMetaData.Live).ToList());
        }