public async Task ItReturnsANewsPageWithImageDocumentssAndLatestNews() { var actionResponse = await _controller.Detail("another-news-article") as ViewResult; var news = actionResponse.ViewData.Model as NewsViewModel; news.NewsItem.Title.Should().Be("Another news article"); news.NewsItem.Slug.Should().Be("another-news-article"); news.NewsItem.Teaser.Should().Be("This is another news article"); news.NewsItem.Image.Should().Be("image.jpg"); news.NewsItem.ThumbnailImage.Should().Be("thumbnail.jpg"); news.NewsItem.Body.Should() .Be( "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aliquam gravida eu mauris in consectetur. Nullam nulla urna, sagittis a ex sit amet, ultricies rhoncus mauris. Quisque vel placerat turpis, vitae consectetur mauris."); news.NewsItem.SunriseDate.Should().Be(new DateTime(2015, 9, 10)); news.NewsItem.SunsetDate.Should().Be(new DateTime(2015, 9, 20)); news.NewsItem.Tags.Should().HaveCount(2); news.NewsItem.Tags.First().Should().Be("Events"); news.GetLatestNews().Should().HaveCount(2); }
public async Task ItReturnsANewsPageWithNoLatestNewsItems() { _repository.Setup(o => o.GetLatest <List <News> >(7)).ReturnsAsync(new HttpResponse(404, null, "not found")); var controller = new NewsController( _repository.Object, _processedContentRepository.Object, _mockRssFeedFactory.Object, _logger.Object, _config.Object, new BusinessId(BusinessId), _filteredUrl.Object ); var response = await controller.Detail("another-news-article") as ViewResult; var model = response.Model as NewsViewModel; model.NewsItem.Slug.Should().Be("another-news-article"); }