public void ExportMultipleConversationsFolderCollisionTest() { List <IConversation> conversations = new List <IConversation>(); conversations.Add(DummyConversationDataGenerator.GetSingleConversation(DummyPhoneNumberId.ObamaCell)); conversations.Add(DummyConversationDataGenerator.GetSingleConversation(DummyPhoneNumberId.HarryLooseTieCell)); const string outputPath = "X:\\backup\\"; MockFileSystem mockFileSystem = new MockFileSystem(); ConversationExporterBase exporter = new ConversationExporterPlaintext(mockFileSystem); exporter.ExportMultipleConversations(conversations, new MockDisplayOptions(), outputPath, null); string createdDirectory = ""; foreach (string directory in mockFileSystem.ListDirectories()) { createdDirectory = directory; } exporter.ExportMultipleConversations(conversations, new MockDisplayOptions(), outputPath, null); Assert.AreEqual(2, mockFileSystem.CountDirectoryContents(createdDirectory)); Assert.AreEqual(2, mockFileSystem.DirectoryCount); Assert.AreEqual(4, mockFileSystem.FileCount); }
public void ExportMultipleConversationsEmptyConversationTest() { List <IConversation> conversations = new List <IConversation>(); conversations.Add(DummyConversationDataGenerator.GetSingleConversation(DummyPhoneNumberId.NeverTexterCell)); const string outputPath = "X:\\backup\\"; MockFileSystem mockFileSystem = new MockFileSystem(); ConversationExporterBase exporter = new ConversationExporterPlaintext(mockFileSystem); exporter.ExportMultipleConversations(conversations, new MockDisplayOptions(), outputPath, null); Assert.AreEqual(0, mockFileSystem.FileCount); }
public void ExportMultipleConversationsTest() { List <IConversation> conversations = new List <IConversation>(); conversations.Add(DummyConversationDataGenerator.GetSingleConversation(DummyPhoneNumberId.ObamaCell)); conversations.Add(DummyConversationDataGenerator.GetSingleConversation(DummyPhoneNumberId.HarryLooseTieCell)); const string outputPath = "X:\\backup\\"; MockFileSystem mockFileSystem = new MockFileSystem(); ConversationExporterBase exporter = new ConversationExporterPlaintext(mockFileSystem); exporter.ExportMultipleConversations(conversations, new MockDisplayOptions(), outputPath, null); Assert.IsTrue(mockFileSystem.DirectoryExists(outputPath)); Assert.AreEqual(2, mockFileSystem.FileCount); }
public void ExportConversations(ExportFormat exportFormat, string exportPath, IProgressCallback progressCallback) { IConversationExporter conversationExporter; switch (exportFormat) { case ExportFormat.Html: conversationExporter = new ConversationExporterHtml(_exportFileSystem); break; case ExportFormat.Plaintext: conversationExporter = new ConversationExporterPlaintext(_exportFileSystem); break; default: throw new ArgumentException("Unrecognized export format."); } _exportErrors = conversationExporter.ExportMultipleConversations(_conversationManager, _displayOptions, exportPath, progressCallback); }
public void ExportMultipleConversationsNameCollisionTest() { IConversation conversationCell = DummyConversationDataGenerator.GetSingleConversation(DummyPhoneNumberId.DavolaCell); IConversation conversationiPhone = DummyConversationDataGenerator.GetSingleConversation(DummyPhoneNumberId.DavolaiPhone); IConversation conversationMerged = new MergedConversation(conversationCell, conversationiPhone); List <IConversation> conversations = new List <IConversation>(); conversations.Add(conversationMerged); string filename = "dummy_filename.txt"; const string outputPath = "X:\\backup\\"; MockFileSystem mockFileSystem = new MockFileSystem(); mockFileSystem.CreateNewFile(Path.Combine(outputPath, filename)); ConversationExporterBase exporter = new ConversationExporterPlaintext(mockFileSystem); exporter.ExportMultipleConversations(conversations, new MockDisplayOptions(), outputPath, null); Assert.AreEqual(2, mockFileSystem.FileCount); }
public void ExportConversations(ExportFormat exportFormat, string exportPath, IProgressCallback progressCallback) { IConversationExporter conversationExporter; switch (exportFormat) { case ExportFormat.Html: conversationExporter = new ConversationExporterHtml(_exportFileSystem); break; case ExportFormat.Plaintext: conversationExporter = new ConversationExporterPlaintext(_exportFileSystem); break; default: throw new ArgumentException("Unrecognized export format."); } _exportErrors = conversationExporter.ExportMultipleConversations(_conversationManager, _displayOptions, exportPath, progressCallback); }