예제 #1
0
        public async Task GetArticlesByDateAsync_ReturnFiltredByDateArticles_WhenGetData()
        {
            // Arrange
            m_MockArticlesSourceService.Setup(service => service.GetDataAsync(SECTION)).ReturnsAsync(ARTICLE_SOURCES.ToList());
            var articlesService       = new ArticlesService(m_MockArticlesSourceService.Object);
            var expectedArticleSource = ARTICLE_SOURCES.First();
            var date             = expectedArticleSource.UpdatedDate;
            var expectedArticles = ARTICLE_SOURCES.Where(a => a.UpdatedDate == date).ToList();

            // Act
            var articles = await articlesService.GetArticlesByDateAsync(SECTION, date.ToString(DATE_FORMAT), DATE_FORMAT);

            // Assert
            m_MockArticlesSourceService.Verify(service => service.GetDataAsync(SECTION), Times.Once);
            Assert.Equal(expectedArticles, articles);
        }