Пример #1
0
        static void Main(string[] args)
        {
            while (true)
            {
                Console.WriteLine("Please select an option from below:");
                Console.WriteLine("1. Press 1 for small dataset");
                Console.WriteLine("2. Press 2 for large dataset");
                Console.WriteLine("3. Press 3 to clear the screen");
                Console.WriteLine("4. Press any other key to exit");

                var key = Console.ReadKey().KeyChar;
                Console.WriteLine();

                string rawString = string.Empty;
                bool   isLarge   = false;
                if (key == '1')
                {
                    rawString = T9FileOperation.GetSmallFileData();
                }
                else if (key == '2')
                {
                    rawString = T9FileOperation.GetLargeFileData();
                    isLarge   = true;
                }
                else if (key == '3')
                {
                    Console.Clear();
                }
                else
                {
                    break;
                }

                if (rawString != string.Empty)
                {
                    DictionarySearch dictionary = new DictionarySearch();

                    dictionary.InsertFromRaw(rawString);

                    Console.WriteLine(dictionary.ToString());
                    T9FileOperation.SaveOutputFile(isLarge, dictionary.ToString());
                    Console.WriteLine(string.Format("Output file saved at {0}", T9FileOperation.OutputPath));

                    Console.WriteLine("");
                }
            }
        }
Пример #2
0
        public void When_SaveOutputFile_NullContent_Expect_True(bool isLarge)
        {
            bool returnValue = T9FileOperation.SaveOutputFile(isLarge, null);

            Assert.IsTrue(returnValue == true);
        }