Exemple #1
0
        public void DuplicatesDetector_ShouldNotDetectSpam(string messageContent1, string messageContent2, string messageContent3, string messageContent4, bool isUserSafe)
        {
            var spamDetectorsTestsService = new SpamDetectorsTestsService <DuplicatedMessagesDetectorStrategy>();
            var spamProbability           = spamDetectorsTestsService.GetSpamProbability(isUserSafe, messageContent1, messageContent2, messageContent3, messageContent4);

            // Assert
            Assert.That(spamProbability, Is.EqualTo(SpamProbability.None));
        }
Exemple #2
0
        public void CapslockDetector_ShouldNotDetectSpam(string m1, string m2, string m3, string m4, string m5, string m6) // not using params to force 6 messages
        {
            var spamDetectorsTestsService = new SpamDetectorsTestsService <CapslockDetectorStrategy>();
            var spamProbability           = spamDetectorsTestsService.GetSpamProbability(isUserSafe: false, m1, m2, m3, m4, m5, m6);

            // Assert
            Assert.That(spamProbability, Is.EqualTo(SpamProbability.None));
        }
Exemple #3
0
        public void LinksDetector_ShouldNotDetectSpam(string messageContent, bool isUserSafe)
        {
            var spamDetectorsTestsService = new SpamDetectorsTestsService <LinksDetectorStrategy>();
            var spamProbability           = spamDetectorsTestsService.GetSpamProbability(isUserSafe, messageContent);

            // Assert
            Assert.That(spamProbability, Is.EqualTo(SpamProbability.None));
        }
Exemple #4
0
        public void FloodDetector_ShouldNotDetectSpam(bool isUserSafe, params int[] secondsBefore)
        {
            var spamDetectorsTestsService = new SpamDetectorsTestsService <FloodDetectorStrategy>();
            var smallMessages             = secondsBefore.Select(x => new SmallMessage("test", AntiSpamTestsService.DEFAULT_TEST_USER_ID, DateTime.UtcNow.AddSeconds(-x), GetMessagesQuery.GET_ALL_SERVERS));
            var spamProbability           = spamDetectorsTestsService.GetSpamProbability(isUserSafe, smallMessages.ToArray());

            // Assert
            Assert.That(spamProbability, Is.EqualTo(SpamProbability.None));
        }