public void TestIsEmailForASCIIMime() { IFile file = Workshare.Policy.Engine.FileFactory.Create(TEST_FOLDER + "NonUnicodeMime.eml", "NonUnicodeMime.eml"); EmailAnalyzer analyzer = new EmailAnalyzer(); Assert.IsTrue(analyzer.IsEmail(file)); }
public void TestIsEmailForUnicodeMSG() { IFile file = Workshare.Policy.Engine.FileFactory.Create(TEST_FOLDER + "unicode.msg", "unicode.msg"); EmailAnalyzer analyzer = new EmailAnalyzer(); Assert.IsTrue(analyzer.IsEmail(file)); }
public void TestIsEmailForUnicodeMime() { IFile file = Workshare.Policy.Engine.FileFactory.Create(TEST_FOLDER + "TagActionTestMail.eml", "TestBigDoc.txt"); EmailAnalyzer analyzer = new EmailAnalyzer(); Assert.IsTrue(analyzer.IsEmail(file)); }
public void TestIsEmailForNormalTextFile() { IFile file = Workshare.Policy.Engine.FileFactory.Create(TEST_FOLDER + "test.txt", "test.txt"); EmailAnalyzer analyzer = new EmailAnalyzer(); Assert.IsFalse(analyzer.IsEmail(file)); }
private Dictionary <string, string> emailLoadAndParse() { EmailAnalyzer analyzer = new EmailAnalyzer(); string emailFilePath = "testemail2.txt"; string emailAsString = new StreamReader(emailFilePath).ReadToEnd(); Dictionary <string, string> emailParsed = analyzer.emailParse(emailAsString); return(emailParsed); }
public void EmailSenderGet() { Dictionary <string, string> email = this.emailLoadAndParse(); EmailAnalyzer analyzer = new EmailAnalyzer(); string senderHostActual = analyzer.emailSenderHostGet(email); string senderHostExpected = "mail76.pandaresearch.com"; Assert.Equal(senderHostExpected, senderHostActual); }
public void EmailBodyURLsGet() { Dictionary <string, string> email = this.emailLoadAndParse(); EmailAnalyzer analyzer = new EmailAnalyzer(); List <string> urlsFromEmailBody = analyzer.emailBodyURLsGet(email); string urlsAsStringActual = String.Join(",", urlsFromEmailBody); Console.WriteLine(urlsAsStringActual); string urlsAsStringExpected = "http://pandaresearch.com/Unsubscribe.jsp,http://www.pandaresearch.com/images/mailImages/mail12_img01.png,http://www.pandaresearchmails.com/mx.jsp?sendTo=mx&a=dpm&uid=9694197&t=av&offid=11729&p=xKAvcj%2BqEhr9yCbzaaLLZA%3D%3D&mt=2,http://www.pandaresearchmails.com/mx.jsp?sendTo=mx&a=dpm&uid=9694197&t=av&offid=11729&p=xKAvcj%2BqEhr9yCbzaaLLZA%3D%3D&mt=2,http://www.pandaresearch.com/privacy,http://www.pandaresearch.com/uc?a=st&pt=terms,http://pandaresearch.com/Unsubscribe.jsp"; Assert.Equal(urlsAsStringExpected, urlsAsStringActual); }
public void TestIsEmailForNonEmail() { IFile file = Workshare.Policy.Engine.FileFactory.Create(TEST_FOLDER + "policyobjects.xml", "policyobjects.xml"); EmailAnalyzer analyzer = new EmailAnalyzer(); Assert.IsFalse(analyzer.IsEmail(file)); IFile file2 = Workshare.Policy.Engine.FileFactory.Create(TEST_FOLDER + "TestProfanity.doc", "TestProfanity.doc"); analyzer = new EmailAnalyzer(); Assert.IsFalse(analyzer.IsEmail(file2)); }
public void NullMatchIsFalse() { EmailAnalyzer ea = new EmailAnalyzer(); Assert.IsFalse(ea.AddressMatch(null, null, null, null, null), "Null params should not match"); }
public void FileTypes() { //setup IUniversalRoutingEntity destination = GetUniversalEntity("Destination", "*****@*****.**", "james", "Cc"); IUniversalRoutingEntity source = GetUniversalEntity("Source", "me@workshare", "me", "From"); destination.Items.Add(GetRoutingItem("*****@*****.**", "Hello", "To")); destination.Items.Add(GetRoutingItem("*****@*****.**", "Hi", "Bcc")); string[] content = new string[] { "bond.cz" }; string[] fields = new string[] { "cc", "bcc", "to" }; EmailAnalyzer ea = new EmailAnalyzer(); Assert.IsTrue(ea.AddressMatch(testFileNonEmail, destination, source, fields, content), "Expecting a match on {0}", content[0]); }
public void CCDomainMatch() { //setup IUniversalRoutingEntity destination = GetUniversalEntity("Destination", "*****@*****.**", "james", "Cc"); IUniversalRoutingEntity source = GetUniversalEntity("Source", "me@workshare", "me", "From"); string[] content = new string[] { "wsdev.net" }; string[] fields = new string[] { "cc" }; EmailAnalyzer ea = new EmailAnalyzer(); //execute Assert.IsTrue(ea.AddressMatch(testFileEmail, destination, source, fields, content), "Expecting a match on {0}", content[0]); }