/// <summary>
        /// The application entry point.
        /// </summary>
        /// <param name="args">
        /// The command line arguments.
        /// </param>
        static void Main(string[] args)
        {
            var conversationExporter = new ConversationExporter();
            ConversationExporterConfiguration configuration = new CommandLineArgumentParser().ParseCommandLineArguments(args);

            conversationExporter.ExportConversation(configuration);
        }
Example #2
0
        /// <summary>
        /// Helper method to initialise the command line arguments and throw argument null errors.
        /// </summary>
        /// <param name="exporterConfiguration">
        /// The configuration for the conversation to be exported.
        /// </param>
        /// <exception cref="ArgumentNullException">
        /// Thrown when input path is null.
        /// </exception>
        public static void ManageArguments(ConversationExporterConfiguration exporterConfiguration)
        {
            var conversationExporter = new ConversationExporter();
            var exporterParameters   = new ConversationExporterParameters(exporterConfiguration);

            conversationExporter.ExportConversation(exporterParameters);
        }
Example #3
0
        /// <summary>
        /// The application entry point.
        /// </summary>
        /// <param name="args">
        /// The command line arguments.
        /// </param>

        static void Main(string[] args)
        {
            var conversationExporter = new ConversationExporter();
            ConversationExporterConfiguration configuration = new CommandLineArgumentParser().ParseCommandLineArguments(args);

            /// <summary>
            /// The conversation is read, input file is specified as chat.txt
            /// </summary>
            /// <param name="c">
            /// the returned object from ReadConversation c is used in WriteConversation
            /// </param>
            /// <summary>
            /// The conversation is exported as json
            /// </summary>
            // Console.WriteLine(agentsStatus_1);
            conversationExporter.ReadConversation(configuration.inputFilePath);
            Message c = conversationExporter.ReadConversation(configuration.inputFilePath);
            //Construct the Pipeline object
            MessageSelectionPipeline messageStatusPipeline = new MessageSelectionPipeline();

            //Register the filters to be executed
            messageStatusPipeline.Register(new FindUserFilter())
            .Register(new SearchWordFilter())
            /* .Register(new RedactWordFiltercs())*/;
            //Start pipeline processing
            var agentsStatus_1 = messageStatusPipeline.Process(Message.Messag);

            conversationExporter.WriteConversation(c, configuration.outputFilePath);
            conversationExporter.ExportConversation(configuration.inputFilePath, configuration.outputFilePath);
            //conversationExporter.FindUser(c, configuration.user);
            //conversationExporter.SearchWord(c, configuration.user);
            //conversationExporter.RedactWord(c, configuration.blacklistPath, configuration.redactedConversationPath);
        }
Example #4
0
        /// <summary>
        /// The application entry point.
        /// </summary>
        /// <param name="args">
        /// The command line arguments.
        /// </param>
        static void Main(string[] args)
        {
            // We use Microsoft.Extensions.Configuration.CommandLine and Configuration.Binder to read command line arguments.
            var configuration         = new ConfigurationBuilder().AddCommandLine(args).Build();
            var exporterConfiguration = configuration.Get <ConversationExporterConfiguration>();

            var filters = new List <IFilter>();

            if (!string.IsNullOrEmpty(exporterConfiguration.FilterByUser))
            {
                filters.Add(new UserFilter(exporterConfiguration.FilterByUser.Split(',')));
            }

            if (!string.IsNullOrEmpty(exporterConfiguration.FilterByKeyword))
            {
                filters.Add(new KeywordFilter(exporterConfiguration.FilterByKeyword.Split(',')));
            }

            if (!string.IsNullOrEmpty(exporterConfiguration.Blacklist))
            {
                filters.Add(new Blacklist(exporterConfiguration.Blacklist.Split(',')));
            }

            if (exporterConfiguration.Report)
            {
                filters.Add(new Report());
            }

            var conversationExporter = new ConversationExporter(filters);

            conversationExporter.ExportConversation(exporterConfiguration.InputFilePath, exporterConfiguration.OutputFilePath);
        }
Example #5
0
        static void Main(string[] args)
        {
            // We use Microsoft.Extensions.Configuration.CommandLine and Configuration.Binder to read command line arguments.
            var configuration         = new ConfigurationBuilder().AddCommandLine(args).Build();
            var exporterConfiguration = configuration.Get <ConversationExporterConfiguration>();
            var conversationExporter  = new ConversationExporter();
            var option = "";

            Console.WriteLine("Please enter the option you would like to execute: \n\n" +
                              "1. To export entire conversation to a JSON file, type in --export \n" +
                              "2. To filter messages by a user and export to a JSON file, type in --filterByUser <user> \n" +
                              "3. To filter messages by a keyword and export to a JSON file, type in --filterByKeyword <keyword> \n" +
                              "4. To hide specific words from the messages and export to a JSON file, type in --blacklist <word1>,<word2> \n" +
                              "5. To create a report of the number of messages each user sent and export to a JSON file, type in --report");

            option = Console.ReadLine();

            if (option == "--export")
            {
                conversationExporter.ExportConversation(exporterConfiguration.InputFilePath, exporterConfiguration.OutputFilePath);
            }
            else if (option.Contains("--filterByUser "))
            {
                var split = option.Split(' ');
                var user  = split[1];
                conversationExporter.FilterByUser(user, exporterConfiguration.InputFilePath, exporterConfiguration.OutputFilePath);
            }
            else if (option.Contains("--filterByKeyword "))
            {
                var split   = option.Split(' ');
                var keyword = split[1];
                conversationExporter.FilterByKeyword(keyword, exporterConfiguration.InputFilePath, exporterConfiguration.OutputFilePath);
            }
            else if (option.Contains("--blacklist "))
            {
                var commandSplit = option.Split(' ');
                var valueSplit   = commandSplit[1].Split(',');

                List <string> wordsToExcludeFromMesssages = new List <string>();

                for (int i = 0; i < valueSplit.Length; i++)
                {
                    wordsToExcludeFromMesssages.Add(valueSplit[i]);
                }

                conversationExporter.BlackList(wordsToExcludeFromMesssages, exporterConfiguration.InputFilePath, exporterConfiguration.OutputFilePath);
            }
            else if (option.Contains("--report"))
            {
                conversationExporter.Report(exporterConfiguration.InputFilePath, exporterConfiguration.OutputFilePath);
            }
            else
            {
                Console.WriteLine("Invalid option entry! Please choose an option as described above");
            }
        }
        /// <summary>
        /// The application entry point.
        /// </summary>
        /// <param name="args">
        /// The command line arguments.
        /// </param>
        static void Main(string[] args)
        {
            // We use Microsoft.Extensions.Configuration.CommandLine and Configuration.Binder to read command line arguments.
            var configuration         = new ConfigurationBuilder().AddCommandLine(args).Build();
            var exporterConfiguration = configuration.Get <ConversationExporterConfiguration>();

            var conversationExporter = new ConversationExporter();

            conversationExporter.ExportConversation(exporterConfiguration.InputFilePath, exporterConfiguration.OutputFilePath);
        }
        /// <summary>
        /// The application entry point.
        /// </summary>
        /// <param name="args">
        /// The command line arguments.
        /// </param>
        static void Main(string[] args)
        {
            var conversationExporter = new ConversationExporter();
            ConversationExporterConfiguration configuration = new CommandLineArgumentParser().ParseCommandLineArguments(args);

            conversationExporter.ExportConversation(
                configuration.InputFilePath,
                configuration.OutputFilePath,
                configuration.UserName,
                configuration.Keyword,
                configuration.Blacklist,
                configuration.EncryptUsernames,
                configuration.HideNumbers);
        }
Example #8
0
        static void Main(string[] args)
        {
            var conversationExporter = new ConversationExporter();
            var configuration        = new CommandLineArgumentParser().ParseCommandLineArguments(args);

            try
            {
                conversationExporter.ExportConversation(configuration);
            }
            catch (Exception ex)
            {
                Console.WriteLine("The conversation could not be exported due to the following error: " + ex.Message);
            }
        }
        public void CheckKeyword()
        {
            ConversationExporter exporter = new ConversationExporter();
            ConversationExporterConfiguration configuration = new ConversationExporterConfiguration("chat.txt", "chat.json");
            configuration.keyword = "pie";
            configuration.filtersActive = true;
            Conversation conversation = exporter.ReadConversation(configuration);
            var messages = conversation.messages.ToList();

            foreach (Message msg in messages)
            {
                Assert.IsTrue(msg.content.ToLower().Contains(configuration.keyword.ToLower()));
            }
        }
        static void Main(string[] args)
        {
            var configuration = new CommandLineArgumentParser().ParseCommandLineArguments(args);

            if (configuration != null)
            {
                var exporter = new ConversationExporter();
                exporter.ExportConversation(configuration);
            }

            else
            {
                throw new ArgumentNullException(Globals.EXCEPTION_ARGUMENT_NULL_NOT_FOUND);
            }
        }
Example #11
0
        /// <summary>
        /// The application entry point.
        /// </summary>
        /// <param name="args">
        /// The command line arguments.
        /// </param>
        static void Main(string[] args)
        {
            // We use Microsoft.Extensions.Configuration.CommandLine and Configuration.Binder to read command line arguments.
            var configuration         = new ConfigurationBuilder().AddCommandLine(args).Build();
            var exporterConfiguration = configuration.Get <ConversationExporterConfiguration>();
            var conversationExporter  = new ConversationExporter();

            foreach (var arg in args)
            {
                if (arg.Equals("--report"))
                {
                    exporterConfiguration.generateReport = true;
                    break;
                }
            }

            conversationExporter.ExportConversation(exporterConfiguration);
        }
Example #12
0
        /// <summary>
        /// The application entry point.
        /// </summary>
        /// <param name="args">
        /// The command line arguments.
        /// </param>
        /// <summary>
        /// The message content.
        /// </summary>
        static void Main(string[] args)
        {
            // We use Microsoft.Extensions.Configuration.CommandLine and Configuration.Binder to read command line arguments.
            var configuration         = new ConfigurationBuilder().AddCommandLine(args).Build();
            var exporterConfiguration = configuration.Get <ExporterConfiguration>();

            // Building a configuration of the editing of the conversation -
            // couldn't get a boolean flag to work in ExporterConfiguration
            var editorConfiguration = new EditorConfiguration(args);
            var conversationEditor  = new ConversationEditor(editorConfiguration);

            var logCreator = new LogCreator(editorConfiguration);

            var conversationExporter = new ConversationExporter();

            conversationExporter.ExportConversation(exporterConfiguration.InputFilePath,
                                                    exporterConfiguration.OutputFilePath, conversationEditor, logCreator);
        }
Example #13
0
        /// <summary>
        /// The application entry point.
        /// </summary>
        /// <param name="args">
        /// The command line arguments.
        /// </param>
        static void Main(string[] args)
        {
            // We use Microsoft.Extensions.Configuration.CommandLine and Configuration.Binder to read command line arguments.
            var configuration         = new ConfigurationBuilder().AddCommandLine(args).Build();
            var exporterConfiguration = configuration.Get <ConversationExporterConfiguration>();

            var conversationExporter = new ConversationExporter();

            var additionalOptions = new AdditionalConversationOptions(exporterConfiguration);

            var argList = args.ToList();

            if (argList.Contains("--report"))
            {
                exporterConfiguration.Report = true;
            }

            conversationExporter.ExportConversation(exporterConfiguration.InputFilePath, exporterConfiguration.OutputFilePath, additionalOptions);
        }
        public void ExportingConversationExportsConversation()
        {
            ConversationExporter exporter = new ConversationExporter();

            exporter.ExportConversation("chat.txt", "chat.json");

            var serializedConversation = new StreamReader(new FileStream("chat.json", FileMode.Open)).ReadToEnd();

            Conversation savedConversation = JsonConvert.DeserializeObject<Conversation>(serializedConversation);

            Assert.AreEqual("My Conversation", savedConversation.Name);

            var messages = savedConversation.Messages.ToList();

            Assert.AreEqual(DateTimeOffset.FromUnixTimeSeconds(1448470901), messages[0].Timestamp);
            Assert.AreEqual("bob", messages[0].SenderId);
            Assert.AreEqual("Hello there!", messages[0].Content);

            Assert.AreEqual(DateTimeOffset.FromUnixTimeSeconds(1448470905), messages[1].Timestamp);
            Assert.AreEqual("mike", messages[1].SenderId);
            Assert.AreEqual("how are you?", messages[1].Content);

            Assert.AreEqual(DateTimeOffset.FromUnixTimeSeconds(1448470906), messages[2].Timestamp);
            Assert.AreEqual("bob", messages[2].SenderId);
            Assert.AreEqual("I'm good thanks, do you like pie?", messages[2].Content);

            Assert.AreEqual(DateTimeOffset.FromUnixTimeSeconds(1448470910), messages[3].Timestamp);
            Assert.AreEqual("mike", messages[3].SenderId);
            Assert.AreEqual("no, let me ask Angus...", messages[3].Content);

            Assert.AreEqual(DateTimeOffset.FromUnixTimeSeconds(1448470912), messages[4].Timestamp);
            Assert.AreEqual("angus", messages[4].SenderId);
            Assert.AreEqual("Hell yes! Are we buying some pie?", messages[4].Content);

            Assert.AreEqual(DateTimeOffset.FromUnixTimeSeconds(1448470914), messages[5].Timestamp);
            Assert.AreEqual("bob", messages[5].SenderId);
            Assert.AreEqual("No, just want to know if there's anybody else in the pie society...", messages[5].Content);

            Assert.AreEqual(DateTimeOffset.FromUnixTimeSeconds(1448470915), messages[6].Timestamp);
            Assert.AreEqual("angus", messages[6].SenderId);
            Assert.AreEqual("YES! I'm the head pie eater there...", messages[6].Content);
        }
        public void CheckObfuscateUserIDS()
        {
            ConversationExporter exporter = new ConversationExporter();
            ConversationExporterConfiguration configuration = new ConversationExporterConfiguration("chat.txt", "chat.json");
            Conversation conversation = exporter.ReadConversation(configuration);
            var messages = conversation.messages.ToList();

            //messages with obfuscation
            ConversationExporter exporterObfuscate = new ConversationExporter();
            ConversationExporterConfiguration configurationObfuscate = new ConversationExporterConfiguration("chat.txt", "chat.json");
            configurationObfuscate.obfuscateUserIDsFlag = true;
            Conversation obfuscatedConversation = exporterObfuscate.ReadConversation(configurationObfuscate);
            var obfuscatedMsgs = obfuscatedConversation.messages.ToList();

            for(int i =0; i<obfuscatedMsgs.Count; i++)
            {
                Assert.IsTrue(obfuscatedMsgs[i].senderId == configurationObfuscate.usersMapper[messages[i].senderId]);
            }
            //exporterObfuscate.ExportConversation(configurationObfuscate);
        }
        public void CheckAllFiltersTogether()
        {
            ConversationExporter exporter = new ConversationExporter();
            ConversationExporterConfiguration configuration = new ConversationExporterConfiguration("chat.txt", "chat.json");
            configuration.filtersActive = true;
            configuration.keyword = "society";
            configuration.usernameFilter = "bob";
            configuration.wordsBlacklist = new string[] { "pie" };
            configuration.obfuscateUserIDsFlag = true;

            Conversation conversation = exporter.ReadConversation(configuration);
            var messages = conversation.messages.ToList();
            //given conversation should return only 2 messages
            Assert.IsTrue(messages.Count == 1);
            foreach (Message msg in messages)
            {
                Assert.IsTrue(msg.senderId == "User1");
                Assert.IsTrue(msg.content.ToLower().Contains(configuration.keyword.ToLower()));
            }
            //exporter.ExportConversation(configuration);
        }
        public void HideSpecificWordsCheck()
        {
            ConversationExporter exporter = new ConversationExporter();
            ConversationExporterConfiguration configuration = new ConversationExporterConfiguration("chat.txt", "chat.json");
            configuration.wordsBlacklist = new string[2] { "pie", "hell" };
            configuration.filtersActive = true;

            Conversation conversation = exporter.ReadConversation(configuration);
            var messages = conversation.messages.ToList();

            Assert.AreEqual("*redacted*o there!", messages[0].content);
            Assert.AreEqual("I'm good thanks, do you like *redacted*?", messages[2].content);
            Assert.AreEqual("*redacted* yes! Are we buying some *redacted*?", messages[4].content);
            Assert.AreEqual("No, just want to know if there's anybody else in the *redacted* society...", messages[5].content);
            Assert.AreEqual("YES! I'm the head *redacted* eater there...", messages[6].content);
        }
        /// <summary>
        /// The application entry point.
        /// </summary>
        /// <param name="args">
        /// The command line arguments.
        /// </param>
        static void Main(string[] args)
        {
            args = new String[2];
            string inputProceedAnswer = string.Empty;
            string inputFilePath = string.Empty;
            string outputFilePath = string.Empty;
            string outputProceedAnswer = string.Empty;

            #region Input filepath
            while (String.IsNullOrEmpty(inputProceedAnswer) || inputProceedAnswer.ToLower() == "n")
            {
                Console.WriteLine("Please provide the full path of the chat text file you want to export: ");
                inputFilePath = Console.ReadLine();

                while (String.IsNullOrEmpty(inputFilePath))
                {
                    Console.WriteLine("Please provide the full path of the chat text file you want to export:");
                    inputFilePath = Console.ReadLine();
                }

                Console.WriteLine("You have selected the following filepath: '{0}'", inputFilePath);
                Console.WriteLine("Are you sure you this is the correct path? [Y/N]");
                inputProceedAnswer = Console.ReadLine();

                while (String.IsNullOrEmpty(inputProceedAnswer) || (inputProceedAnswer.ToLower() != "y" && inputProceedAnswer.ToLower() != "n"))
                {
                    Console.WriteLine("Please type in 'Y' or 'N' to proceed.");
                    inputProceedAnswer = Console.ReadLine();
                }
            }
            args[0] = inputFilePath;
            #endregion

            #region Output filepath
            while (String.IsNullOrEmpty(outputProceedAnswer) || outputProceedAnswer.ToLower() == "n")
            {
                Console.WriteLine("Please provide the full path of the folder you want to export to: ");
                outputFilePath = Console.ReadLine();

                while (String.IsNullOrEmpty(outputFilePath))
                {
                    Console.WriteLine("Please provide the full path of the folder you want to export to: ");
                    outputFilePath = Console.ReadLine();
                }

                Console.WriteLine("You have selected the following filepath: '{0}'", outputFilePath);
                Console.WriteLine("Are you sure you this is the correct path? [Y/N]");
                outputProceedAnswer = Console.ReadLine();

                while (String.IsNullOrEmpty(outputProceedAnswer) || (outputProceedAnswer.ToLower() != "y" && (outputProceedAnswer.ToLower() != "n")))
                {
                    Console.WriteLine("Please type in 'Y' or 'N' to proceed.");
                    outputProceedAnswer = Console.ReadLine();
                }
            }
            args[1] = outputFilePath;
            #endregion

            var conversationExporter = new ConversationExporter();
            ConversationExporterConfiguration configuration = new CommandLineArgumentParser().ParseCommandLineArguments(args);
            ExportResponse eResponse = conversationExporter.ExportConversation(configuration.inputFilePath, configuration.outputFilePath);
            
            if (!eResponse.Successful)
                Console.WriteLine(eResponse.Message);
            Console.ReadLine();
        }
        /// <summary>
        /// The application entry point.
        /// </summary>
        /// <param name="args">
        /// The command line arguments.
        /// </param>
        static void Main(string[] args)
        {
            var conversationExporter = new ConversationExporter();
            ConversationExporterConfiguration configuration = new CommandLineArgumentParser().ParseCommandLineArguments(args);

            int choice = 0;
            do
            {
                StringBuilder blackListString = new StringBuilder();
                if (configuration.wordsBlacklist != null)
                {
                    blackListString.Append("[");
                    foreach (string str in configuration.wordsBlacklist)
                    {

                        blackListString.Append(str + ",");
                    }
                    blackListString.Remove(blackListString.Length-1, 1);
                    blackListString.Append("]");
                }
                Console.WriteLine("What to do next?");
                Console.WriteLine("1. --Filter By Username-- {0}\n2. --Filter By Keyword-- {1}\n3. --Hide Specific Words-- {2}\n4. --Obfuscate user IDs-- {3}\n5. Clear Filters\n6. Convert and Export", configuration.usernameFilter, configuration.keyword, blackListString.ToString(), configuration.obfuscateUserIDsFlag);
                //read user input
                string key = Console.ReadKey().Key.ToString();
                Console.WriteLine();
                switch (key)
                {
                    case "D1": //filter by username
                        {
                            do
                            {
                                configuration.usernameFilter = conversationExporter.PromptUserForInput("Please give the username to filter with");
                                configuration.filtersActive = true;
                                break;

                            }while(true);

                            break;
                        }
                    case "D2": //filter by keyword
                        {
                            configuration.keyword = conversationExporter.PromptUserForInput("Please give the keyword to filter with");
                            configuration.filtersActive = true;
                            break;
                        }
                    case "D3"://hide keywords
                        {
                            StringBuilder input = new StringBuilder();
                            input.Append(conversationExporter.PromptUserForInput("Enter words to hide separated with comma(,): "));
                            input.Replace(" ", "");
                            if (input[0] == ',')
                            {
                                input.Remove(0, 1);
                            }
                            if (input[input.Length - 1] == ',')
                            {
                                input.Remove(input.Length - 1, 1);
                            }
                            configuration.wordsBlacklist = input.ToString().Split(',');
                            break;
                        }
                    case "D4"://obfuscate user ids
                        {
                            configuration.obfuscateUserIDsFlag = true;
                            break;
                        }
                    case "D5"://clear filters
                        {
                            configuration.usernameFilter = null;
                            configuration.wordsBlacklist = null;
                            configuration.keyword        = null;
                            configuration.filtersActive  = false;
                            configuration.obfuscateUserIDsFlag = false;
                            break;
                        }
                    case "D6"://export
                        {
                            Console.WriteLine("Exporting...\n");
                            choice = 6;
                            break;
                        }
                }

            } while (choice != 6);

            conversationExporter.ExportConversation(configuration);
        }
 public void CompineUsernameAndKeyWordFilter()
 {
     ConversationExporter exporter = new ConversationExporter();
     ConversationExporterConfiguration configuration = new ConversationExporterConfiguration("chat.txt", "chat.json");
     configuration.keyword = "pie";
     configuration.usernameFilter = "bob";
     configuration.filtersActive = true;
     Conversation conversation = exporter.ReadConversation(configuration);
     var messages = conversation.messages.ToList();
     //given conversation should return only 2 messages
     Assert.IsTrue(messages.Count == 2);
     foreach (Message msg in messages)
     {
         Assert.IsTrue(msg.senderId == "bob");
         Assert.IsTrue(msg.content.ToLower().Contains(configuration.keyword.ToLower()));
     }
     //exporter.ExportConversation(configuration);
 }
        public void CheckUsername()
        {
            ConversationExporter exporter = new ConversationExporter();
            ConversationExporterConfiguration configuration = new ConversationExporterConfiguration("chat.txt", "chat.json");
            configuration.usernameFilter = "bob";
            configuration.filtersActive = true;
            Conversation conversation = exporter.ReadConversation(configuration);
            var messages = conversation.messages.ToList();

            foreach (Message msg in messages)
            {
                Assert.AreEqual(configuration.usernameFilter, msg.senderId);
            }
        }
        public void ExportingConversationExportsConversation()
        {
            ConversationExporter exporter = new ConversationExporter();
            ConversationExporterConfiguration configuration = new ConversationExporterConfiguration("chat.txt", "chat.json");
            exporter.ExportConversation(configuration);

            var serializedConversation = new StreamReader(new FileStream("chat.json", FileMode.Open)).ReadToEnd();

            Conversation savedConversation = JsonConvert.DeserializeObject<Conversation>(serializedConversation);

            Assert.AreEqual("My Conversation", savedConversation.name);
            Assert.IsTrue(savedConversation.messages.ToList().Count > 0);
        }
        public void ReadConversationTest()
        {
            ConversationExporter exporter = new ConversationExporter();
            ConversationExporterConfiguration configuration = new ConversationExporterConfiguration("chat.txt", "chat.json");
            Conversation conversation = exporter.ReadConversation(configuration);

            Assert.AreEqual("My Conversation", conversation.name);

            var messages = conversation.messages.ToList();

            Assert.AreEqual(DateTimeOffset.FromUnixTimeSeconds(1448470901), messages[0].timestamp);
            Assert.AreEqual("bob", messages[0].senderId);
            Assert.AreEqual("Hello there!", messages[0].content);

            Assert.AreEqual(DateTimeOffset.FromUnixTimeSeconds(1448470905), messages[1].timestamp);
            Assert.AreEqual("mike", messages[1].senderId);
            Assert.AreEqual("how are you?", messages[1].content);

            Assert.AreEqual(DateTimeOffset.FromUnixTimeSeconds(1448470906), messages[2].timestamp);
            Assert.AreEqual("bob", messages[2].senderId);
            Assert.AreEqual("I'm good thanks, do you like pie?", messages[2].content);

            Assert.AreEqual(DateTimeOffset.FromUnixTimeSeconds(1448470910), messages[3].timestamp);
            Assert.AreEqual("mike", messages[3].senderId);
            Assert.AreEqual("no, let me ask Angus...", messages[3].content);

            Assert.AreEqual(DateTimeOffset.FromUnixTimeSeconds(1448470912), messages[4].timestamp);
            Assert.AreEqual("angus", messages[4].senderId);
            Assert.AreEqual("Hell yes! Are we buying some pie?", messages[4].content);

            Assert.AreEqual(DateTimeOffset.FromUnixTimeSeconds(1448470914), messages[5].timestamp);
            Assert.AreEqual("bob", messages[5].senderId);
            Assert.AreEqual("No, just want to know if there's anybody else in the pie society...", messages[5].content);

            Assert.AreEqual(DateTimeOffset.FromUnixTimeSeconds(1448470915), messages[6].timestamp);
            Assert.AreEqual("angus", messages[6].senderId);
            Assert.AreEqual("YES! I'm the head pie eater there...", messages[6].content);

            Assert.AreEqual(DateTimeOffset.FromUnixTimeSeconds(1448470918), messages[7].timestamp);
            Assert.AreEqual("angus", messages[7].senderId);
            Assert.AreEqual("", messages[7].content);
        }
 public void FailToReadConversation()
 {
     ConversationExporter exporter = new ConversationExporter();
     ConversationExporterConfiguration configuration = new ConversationExporterConfiguration(null, "chat.json");
     try
     {
         exporter.ReadConversation(configuration);
     }
     catch (Exception)
     {
         configuration.inputFilePath="chat.txt";
         exporter.ReadConversation(configuration);
     }
 }
 public void FailToExport()
 {
     ConversationExporter exporter = new ConversationExporter();
     ConversationExporterConfiguration configuration = new ConversationExporterConfiguration("chat.txt", "fileNotAllowedToAccess.json");
     try
     {
         exporter.ExportConversation(configuration);
     }
     catch (Exception)
     {
         //catching the exception and correcting the file
         configuration.outputFilePath = "chat.json";
         exporter.ExportConversation(configuration);
     }
 }