Пример #1
0
        public async Task GetStoryByIdTest()
        {
            IEnumerable <int> storyIds = await _hackerNewsAPI.GetNewStoriesAsync();

            Random random        = new Random();
            int    storyPosition = random.Next(0, storyIds.Count());

            StoryDto story = await _hackerNewsAPI.GetStoryByIdAsync(storyIds.ToArray()[storyPosition]);

            Assert.True(story != null, "Story not found");

            Assert.True(!string.IsNullOrWhiteSpace(story.Url), "Url not found");

            Assert.True(!string.IsNullOrWhiteSpace(story.By), "Author not found");

            Assert.True(!string.IsNullOrWhiteSpace(story.Title), "Title not found");
        }