Example #1
0
        public void controlFailHeaderAnalysis()
        {
            Control c = new Control();
            string _head = "aninvalidheader";
            string _body = "+44740296761\r\nAn invalid text message.";

            c.analyzeMessage(_head, _body);
        }
Example #2
0
        public void controlFailBodyAnalysis()
        {
            Control c = new Control();
            string _head = "S123456789";
            string _body = "+44740296761\r\nAn invalid text message it is too long. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec ullamcorper felis et erat vestibulum, a tincidunt felis efficitur massa nunc.";

            c.analyzeMessage(_head, _body);
        }
Example #3
0
        public void tweetFailSenderAnalysis()
        {
            Control c = new Control();
            string _head = "T123456789";
            string _body = "an invalid twitter username as sender\r\nThis is a tweet that will fail analysis.";

            Tweet testTweet = new Tweet(_head, _body);

            testTweet.anaylizeMessage();
        }
Example #4
0
        public void emailFailSenderAnalysis()
        {
            Control c = new Control();
            string _head = "E123456789";
            string _body = "an invalid email address as sender\r\nTest email\r\nA test email that will fail the analysis test.";

            Email testEmail = new Email(_head, _body);

            testEmail.anaylizeMessage();
        }
Example #5
0
        public void emailFailSubjectAnalysis()
        {
            Control c = new Control();
            string _head = "E123456789";
            string _body = "[email protected]\r\nThis email subject is too long \r\nA test email that will fail the analysis test.";

            Email testEmail = new Email(_head, _body);

            testEmail.anaylizeMessage();
        }
Example #6
0
        public void emailFailTextAnalysis()
        {
            Control c = new Control();
            string _head = "E123456789";
            string _body = "[email protected]\r\nTest email\r\nThis email text is far too long. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin eget lobortis sapien. Proin tempor, lectus nec eleifend condimentum, nisl ex laoreet ipsum, sed placerat elit ante a nulla. Pellentesque id odio non orci convallis vehicula vel vel ante. Vestibulum tincidunt vitae diam in aliquam. Ut efficitur enim augue, at maximus arcu gravida in. Nullam leo enim, feugiat in laoreet at, interdum sit amet lacus. Aenean sed augue elementum, accumsan ante quis, consequat lectus. In in malesuada nibh, eget faucibus nunc. In lobortis tincidunt urna. Fusce a porttitor tellus. Praesent facilisis porttitor diam, ut congue nisi molestie vitae. Etiam faucibus nibh sit amet lectus ullamcorper, et pretium sapien dictum. Pellentesque volutpat diam ligula, pellentesque interdum metus commodo eget. Suspendisse fringilla pellentesque neque, vestibulum blandit enim euismod consectetur. Pellentesque nec egestas quam. Morbi at efficitur erat. Vivamus ornare eros diam, eget gravida sapien dapibus id. Phasellus dictum dictum nullam";

            Email testEmail = new Email(_head, _body);

            testEmail.anaylizeMessage();
        }
Example #7
0
        public void smsFailSenderAnalaysis()
        {
            Control c = new Control();

            string _head = "S123456789";
            string _body = "This is not a valid phone number!\r\nA test text that will fail validization.";

            Sms testSms = new Sms(_head, _body);

            testSms.anaylizeMessage();
        }
Example #8
0
        public void emailQuarantineUrl()
        {
            Control c = new Control();
            string expectedText = " <URL Quarantined> <URL Quarantined>";
            string _head = "E123456789";
            string _body = "[email protected]\r\nTest email\r\n https://www.google.co.uk https://www.facebook.com";

            Email emailTest = new Email(_head, _body);

            emailTest.anaylizeMessage();

            Assert.AreEqual(expectedText, emailTest.MessageText);
        }
Example #9
0
        public void smsAnalyzeTextSpeakInsideWord()
        {
            Control c = new Control();
            string expected = "wordLOLword";
            string _head = "S123456789";
            string _body = "+447402967712\r\nwordLOLword";

            Sms testSms = new Sms(_head, _body);

            testSms.anaylizeMessage();

            Assert.AreEqual(expected, testSms.MessageText);
        }
Example #10
0
        public void sirEmailFailSirSubjectAnalysis()
        {
            Control c = new Control();
            SirEmail.fillIncidents();
            string _head = "E123456789";
            string _body = "[email protected]\r\nNot a SIR subject\r\n09-12-45\r\nTheft\r\nThis is a SIR email that will fail validization";

            Email testEmail = new Email(_head, _body);

            testEmail.anaylizeMessage();

            Assert.IsFalse(SirEmail.checkIfSir(testEmail));
        }
Example #11
0
        public void tweetAddHashtagCount()
        {
            Control c = new Control();
            int expectedCount = 2;
            string _head = "T123456789";
            string _body = "@sam\r\n#great #fancy";

            Tweet testTweet = new Tweet(_head, _body);

            testTweet.anaylizeMessage();

            Assert.AreEqual(expectedCount, Control.HASHTAGDICT.Count);
        }
Example #12
0
        public void smsAnalyzeTextSpeak()
        {
            Control c = new Control();
            string expected = "LOL<Laughing out loud>";
            string _head = "S123456789";
            string _body = "+447402967712\r\nLOL";

            Sms testSms = new Sms(_head, _body);

            testSms.anaylizeMessage();

            Assert.AreEqual(expected, testSms.MessageText);
        }
Example #13
0
 public void controlTestAnalysis()
 {
     Control c = new Control();
     string _head = "S123456789";
     string _body = "+44740296761\r\nA valid text message.";
     try
     {
         c.analyzeMessage(_head, _body);
     }
     catch (Exception ex)
     {
         Assert.Fail("Expected no exception, but got: " + ex.Message);
     }
 }
Example #14
0
        public void tweetNoHashtag()
        {
            Control c = new Control();

            int expectedCount = 0;
            string _head = "T123456789";
            string _body = "@sam\r\nnone of theese words are hastags. # ";

            Tweet testTweet = new Tweet(_head, _body);

            testTweet.anaylizeMessage();

            Assert.AreEqual(expectedCount, Control.HASHTAGDICT.Count);
        }
Example #15
0
        public void tweetAnalysis()
        {
            Control c = new Control();
            string _head = "T123456789";
            string _body = "@sam\r\nA test tweet that will pass analysis.";

            Tweet testTweet = new Tweet(_head, _body);
            try
            {
                testTweet.anaylizeMessage();
            }
            catch (Exception ex)
            {
                Assert.Fail("Expected no exception, but got: " + ex.Message);
            }
        }
Example #16
0
        public void emailAnalysis()
        {
            Control c = new Control();
            string _head = "E123456789";
            string _body = "[email protected]\r\nTest email\r\nA test email that will pass the analysis test.";

            Email testEmail = new Email(_head, _body);
            try
            {
                testEmail.anaylizeMessage();
            }
            catch (Exception ex)
            {
                Assert.Fail("Expected no exception, but got: " + ex.Message);
            }
        }
Example #17
0
        public void sirEmailFailIncidentAnalysis()
        {
            Control c = new Control();
            SirEmail.fillIncidents();
            string _head = "E123456789";
            string _body = "[email protected]\r\nSIR 12/12/15\r\n09/23/67\r\nThis incident isnt in the Incident list\r\nThis is a SIR email that will fail validization";

            Email testEmail = new Email(_head, _body);

            testEmail.anaylizeMessage();

            SirEmail.checkIfSir(testEmail);

            SirEmail testSirEmail = new SirEmail(testEmail);

            testSirEmail.anaylizeMessage();
        }
Example #18
0
        public void smsAnalaysis()
        {
            Control c = new Control();
            string _head = "S123456789";
            string _body = "+447402967712\r\nA test text that will pass validization.";

            Sms testSms = new Sms(_head, _body);

            try
            {
                testSms.anaylizeMessage();
            }
            catch (Exception ex)
            {
                Assert.Fail("Expected no exception, but got: " + ex.Message);
            }
        }
Example #19
0
        public void sirEmailAnalysis()
        {
            Control c = new Control();
            SirEmail.fillIncidents();
            string _head = "E123456789";
            string _body = "[email protected]\r\nSIR 12/12/15\r\n09-12-45\r\nTheft\r\nThis is a SIR email that will pass validization";

            Email testEmail = new Email(_head, _body);

            testEmail.anaylizeMessage();

            SirEmail.checkIfSir(testEmail);

            SirEmail testSirEmail = new SirEmail(testEmail);

            try
            {
                testSirEmail.anaylizeMessage();
            }
            catch (Exception ex)
            {
                Assert.Fail("Expected no exception, but got: " + ex.Message);
            }
        }
Example #20
0
        public void smsAnalyzeTextSpeakInsidePunctuation()
        {
            Control c = new Control();

            string expected = ",ROTFL<Rolling on the floor laughing>,";

            string _head = "S123456789";
            string _body = "+447402967712\r\n,ROTFL,";

            Sms testSms = new Sms(_head, _body);

            testSms.anaylizeMessage();

            Assert.AreEqual(expected, testSms.MessageText);
        }
Example #21
0
        public void tweetAddMentionCount()
        {
            Control c = new Control();
            int expectedCount = 2;
            string _head = "T123456789";
            string _body = "@sam\r\nGreat coursework! @rob @Lu";

            Tweet testTweet = new Tweet(_head, _body);

            testTweet.anaylizeMessage();

            Assert.AreEqual(expectedCount, Control.MENTIONLIST.Count);
        }
Example #22
0
        public void sirEmailSIRListCount()
        {
            Control c = new Control();
            SirEmail.fillIncidents();
            int expectedCount = 1;
            string _head = "E123456789";
            string _body = "[email protected]\r\nSIR 12/12/15\r\n09-12-45\r\nTheft\r\nThis is a SIR email that will pass validization";

            Email testEmail = new Email(_head, _body);

            testEmail.anaylizeMessage();

            SirEmail.checkIfSir(testEmail);

            SirEmail testSirEmail = new SirEmail(testEmail);

            testSirEmail.anaylizeMessage();

            Assert.AreEqual(expectedCount, Control.SIRLIST.Count);
        }
Example #23
0
        public void emailQuarantineCount()
        {
            Control c = new Control();
            int expectedCount = 2;
            string _head = "E123456789";
            string _body = "[email protected]\r\nTest email\r\n https://www.google.co.uk https://www.facebook.com";

            Email emailTest = new Email(_head, _body);

            emailTest.anaylizeMessage();

            Assert.AreEqual(expectedCount, emailTest.UrlList.Count);
        }