Exemplo n.º 1
0
        public async Task PercentageWithPhotoUrls_IsGreaterThanZero_WhenSomeTweetsHavePhotoUrls()
        {
            var statsService = new TweetStatisticsService();

            SetUpTweetList(statsService, TestData.TweetList);
            await statsService.UpdateStatisticsAsync();

            var stats = statsService.GetStatistics();

            Assert.AreEqual((decimal)75.00, stats.PercentWithPhotoUrls);
        }
Exemplo n.º 2
0
        public async Task PercentageWithPhotoUrls_IsOneHundred_WhenAllTweetsHavePhotoUrls()
        {
            var statsService = new TweetStatisticsService();

            SetUpTweetList(statsService, TestData.TweetListWithAllEntities);
            await statsService.UpdateStatisticsAsync();

            var stats = statsService.GetStatistics();

            Assert.AreEqual((decimal)100.00, stats.PercentWithPhotoUrls);
        }
Exemplo n.º 3
0
        public async Task PercentageWithEmojis_IsZero_WhenNoTweetsHaveEmoji()
        {
            var statsService = new TweetStatisticsService();

            SetUpTweetList(statsService, TestData.TweetList);
            await statsService.UpdateStatisticsAsync();

            var stats = statsService.GetStatistics();

            Assert.AreEqual(0, stats.PercentWithEmoji);
        }
Exemplo n.º 4
0
        public async Task PercentageWithEmojis_IsGreaterThanZero_WhenSomeTweetsHaveEmoji()
        {
            var statsService = new TweetStatisticsService();

            SetUpTweetList(statsService, TestData.TweetListWithSomeEmoji);
            await statsService.UpdateStatisticsAsync();

            var stats = statsService.GetStatistics();

            Assert.AreEqual((decimal)33.33, stats.PercentWithEmoji);
        }
Exemplo n.º 5
0
        public async Task TotalTweets()
        {
            var statsService = new TweetStatisticsService();

            SetUpTweetList(statsService, TestData.TweetList);
            await statsService.UpdateStatisticsAsync();

            var stats = statsService.GetStatistics();

            Assert.AreEqual(TestData.TweetList.Count, stats.Total);
        }
Exemplo n.º 6
0
        public async Task AvgTweetRates_TweetsPerSecond_IsGreaterThanZero()
        {
            var statsService = new TweetStatisticsService();

            SetUpTweetList(statsService, TestData.TweetList);
            await statsService.UpdateStatisticsAsync();

            var stats = statsService.GetStatistics();

            Assert.IsTrue(stats.AvgTweetRates.AvgTweetsPerSecond > 0);
        }
Exemplo n.º 7
0
        public async Task TopHashtags_IsEmpty_WhenNoTweetsHaveAnyHastags()
        {
            var statsService = new TweetStatisticsService();

            SetUpTweetList(statsService, TestData.TweetListWithoutEntities);
            await statsService.UpdateStatisticsAsync();

            var stats = statsService.GetStatistics();

            Assert.AreEqual(0, stats.TopHashtags.Count);
        }
Exemplo n.º 8
0
        public async Task TopEmoji_IsEmpty_WhenNoTweetsHaveEmoji()
        {
            var statsService = new TweetStatisticsService();

            SetUpTweetList(statsService, TestData.TweetList);
            await statsService.UpdateStatisticsAsync();

            var stats = statsService.GetStatistics();

            Assert.AreEqual(0, stats.TopEmoji.Count);
        }
Exemplo n.º 9
0
        public async Task PercentWithUrls_IsZero_WhenTweetsHaveNoUrls()
        {
            var statsService = new TweetStatisticsService();

            SetUpTweetList(statsService, TestData.TweetListWithoutEntities);
            await statsService.UpdateStatisticsAsync();

            var stats = statsService.GetStatistics();

            Assert.AreEqual(0, stats.PercentWithUrls);
        }
Exemplo n.º 10
0
        public async Task TopHashtags_HasFewerThanThreeItems_WhenThereAreFewerThanThreeHashtags()
        {
            var statsService = new TweetStatisticsService();

            SetUpTweetList(statsService, TestData.TweetList.Take(2).ToList());
            await statsService.UpdateStatisticsAsync();

            var stats = statsService.GetStatistics();

            Assert.AreEqual(2, stats.TopHashtags.Count);
            Assert.AreEqual("Hashtag1", stats.TopHashtags[0]);
            Assert.AreEqual("Hashtag2", stats.TopHashtags[1]);
        }
Exemplo n.º 11
0
        public async Task TopEmoji_HasMaxThreeItems_WhenThereAreMoreThanThreeEmoji()
        {
            var statsService = new TweetStatisticsService();

            SetUpTweetList(statsService, new List <Tweet> {
                TestData.TweetWithDifferentEmoji
            });
            await statsService.UpdateStatisticsAsync();

            var stats = statsService.GetStatistics();

            Assert.AreEqual(3, stats.TopEmoji.Count);
        }
Exemplo n.º 12
0
        public async Task TopDomains_HasFewerThanThreeItems_WhenThereAreFewerThanThreeUrls()
        {
            var statsService = new TweetStatisticsService();

            SetUpTweetList(statsService, TestData.TweetList.Take(2).ToList());
            await statsService.UpdateStatisticsAsync();

            var stats = statsService.GetStatistics();

            Assert.AreEqual(2, stats.TopDomains.Count);
            Assert.AreEqual("www.twitter.com", stats.TopDomains[0]);
            Assert.AreEqual("www.wwe.com", stats.TopDomains[1]);
        }
Exemplo n.º 13
0
        public async Task TopEmoji_HasFewerThanThreeItems_WhenThereAreFewerThanThreeEmoji()
        {
            var tweetList = new List <Tweet> {
                new Tweet {
                    Data = new TweetData {
                        Text = "Tweet with 2 emoji 👍 📺"
                    }
                }
            };

            var statsService = new TweetStatisticsService();

            SetUpTweetList(statsService, tweetList);
            await statsService.UpdateStatisticsAsync();

            var stats = statsService.GetStatistics();

            Assert.AreEqual(2, stats.TopEmoji.Count);
        }