public void GetArticlesByYear()
        {
            for (int year = 2015; year < 2025; year++)
            {
                // Manually get articles and sort them
                var articlesThisYear = _articles.FindAll(a => a.PublishDate.Year == year).ConvertAll(a => a.Metadata);
                articlesThisYear.Sort((a1, a2) => (a2.PublishDate.CompareTo(a1.PublishDate)));

                // Get articles thru service.  They should be sorted
                var returnedArticles     = Store.GetArticleMetadatasAsync(new DateTime(year, 1, 1), new DateTime(year + 1, 1, 1).AddSeconds(-1)).GetAwaiter().GetResult();
                var returnedArticlesList = new List <ArticleMetadata>(returnedArticles);

                AssertArticleListsAreEqual(articlesThisYear, returnedArticlesList);
            }
        }
Пример #2
0
 public Task <IEnumerable <ArticleMetadata> > GetArticleMetadatasAsync(DateTime startDate, DateTime endDate)
 {
     ++GetArticleMetadatasSyncCount;
     return(InMemoryArticleStore.GetArticleMetadatasAsync(startDate, endDate));
 }