public void IMAPTest_email_imap_smtp_collector_filtered_via_FrameworkController2() { var messagePatterns = new[] { new[] { "19.08.2013 15:49:27", "\"[email protected]\" <*****@*****.**>", "*****@*****.**", "27 - 28", "27 nikoliv za novou pracovn? smlouvu.\r\n28 Pokud je pracovn? smlouva vyhotovena p?semn? pozd?ji ne? v den \r\nn?stupu zam?stnance do pr?ce,\r\n" }, new[] { "19.08.2013 15:51:33", "TestPC01 <*****@*****.**>", "*****@*****.**", "priloha pdf", "This is a multi-part message in MIME format.\r\n" }, new[] { "19.08.2013 15:52:59", "\"[email protected]\" <*****@*****.**>", "*****@*****.**", "36 - 40 rtf", "This is a multi-part message in MIME format.\r\n" } }; this.FrameworkController.ProcessCapture(this.PrepareCaptureForProcessing(SnoopersPcaps.Default.email_imap_smtp_collector_filtered_pcap)); var conversations = this.L7Conversations.ToArray(); this.FrameworkController.ExportData(this.AvailableSnoopersTypes, conversations, this.CurrentTestBaseDirectory, true); //Assert.AreEqual(1, this.SnooperExports.Count); SnooperExportIMAP exportedObjectsReference = null; foreach (var exportedObjects in this.SnooperExports.ToArray()) //Get IMAPSnooper exported objects { if ((exportedObjectsReference = exportedObjects as SnooperExportIMAP) != null) { break; } } Assert.IsNotNull(exportedObjectsReference); var exportedObjectBases = exportedObjectsReference.ExportObjects.ToArray(); Assert.AreEqual(3, exportedObjectBases.Length); var messages = exportedObjectBases.Where(i => i is MIMEemail).Cast <MIMEemail>().OrderBy(it => it.TimeStamp).ToArray(); Assert.AreEqual(3, messages.Length); //Every exported object should be private message Assert.AreEqual(messagePatterns.Length, messages.Length); //Both arrays should have same length for (var i = 0; i < messages.Length; i++) { Assert.AreEqual(messages[i].TimeStamp.ToString(new CultureInfo("cs-CZ", false)), messagePatterns[i][0]); Assert.AreEqual(messages[i].From, messagePatterns[i][1]); Assert.AreEqual(messages[i].To, messagePatterns[i][2]); Assert.AreEqual(messages[i].Subject, messagePatterns[i][3]); Assert.AreEqual(messages[i].RawContent, messagePatterns[i][4]); } //Assert.AreEqual(3, this.GetExportedObjectCount()); }
public void IMAPTest_email_imap_smtp_collector_via_FrameworkController2() { var messagePatterns = new[] { new[] { "19.08.2013 15:42:26", "TestPC02 <*****@*****.**>", "TestPC01 <*****@*****.**>", "1 - 3 rtf", "This is a multi-part message in MIME format.\r\n" }, new[] { "19.08.2013 15:43:42", "TestPC02 <*****@*****.**>", "TestPC01 <*****@*****.**>", "4 - 8 rtf", "This is a multi-part message in MIME format.\r\n" }, new[] { "19.08.2013 15:44:43", "TestPC02 <*****@*****.**>", "TestPC01 <*****@*****.**>", "priloha .txt", "This is a multi-part message in MIME format.\r\n" }, new[] { "19.08.2013 15:50:23", "TestPC04 <*****@*****.**>", "*****@*****.**", "29 - 30", "29 vznikl ji? pracovn? pom?r na z?klad? ?stn? sjednan? pracovn? smlouvy.\r\n30 Dodate?n? p?semn? vyhotoven? pracovn? smlouvy m? u? jen povahu \r\npotvrzen? toho,\r\n" }, new[] { "19.08.2013 15:54:11", "\"[email protected]\" <*****@*****.**>", "*****@*****.**", "46 - 50 rtf", "This is a multi-part message in MIME format.\r\n" } }; this.FrameworkController.ProcessCapture(this.PrepareCaptureForProcessing(SnoopersPcaps.Default.email_imap_smtp_collector_pcap)); var conversations = this.L7Conversations.ToArray(); this.FrameworkController.ExportData(this.AvailableSnoopersTypes, conversations, this.CurrentTestBaseDirectory, true); SnooperExportIMAP exportedObjectsReference = null; foreach (var exportedObjects in this.SnooperExports.ToArray()) //Get IMAPSnooper exported objects { if ((exportedObjects is SnooperExportIMAP) && exportedObjects.TimeStampFirst.ToString(new CultureInfo("cs-CZ", false)).Equals("19.08.2013 15:42:26")) { exportedObjectsReference = (SnooperExportIMAP)exportedObjects; break; } } Assert.IsNotNull(exportedObjectsReference); var exportedObjectBases = exportedObjectsReference.ExportObjects.ToArray(); Assert.AreEqual(5, exportedObjectBases.Length); var messages = exportedObjectBases.Where(i => i is MIMEemail).Cast <MIMEemail>().OrderBy(it => it.TimeStamp).ToArray(); Assert.AreEqual(5, messages.Length); //Every exported object should be private message Assert.AreEqual(messagePatterns.Length, messages.Length); //Both arrays should have same length for (var i = 0; i < messages.Length; i++) { Assert.AreEqual(messages[i].TimeStamp.ToString(new CultureInfo("cs-CZ", false)), messagePatterns[i][0]); Assert.AreEqual(messages[i].From, messagePatterns[i][1]); Assert.AreEqual(messages[i].To, messagePatterns[i][2]); Assert.AreEqual(messages[i].Subject, messagePatterns[i][3]); Assert.AreEqual(messages[i].RawContent, messagePatterns[i][4]); } }