예제 #1
0
        public async Task GetArticlesByShortUrlAsync_ReturnFiltredByShortUrl_WhenGetData()
        {
            // Arrange
            m_MockArticlesSourceService.Setup(service => service.GetDataAsync(null)).ReturnsAsync(ARTICLE_SOURCES.ToList());
            var articlesService = new ArticlesService(m_MockArticlesSourceService.Object);
            var expectedArticle = ARTICLE_SOURCES.Last();
            var shortUrl        = expectedArticle.ShortUrl;

            // Act
            var article = await articlesService.GetArticlesByShortUrlAsync(shortUrl, SHORT_URL_FORMAT);

            // Assert
            m_MockArticlesSourceService.Verify(service => service.GetDataAsync(null), Times.Once);
            Assert.Equal(expectedArticle, article);
        }