Exemplo n.º 1
0
        public void When_ToString_Valid_Expect_CaseString(string validstring)
        {
            DictionarySearch dictionary = new DictionarySearch();

            dictionary.InsertFromRaw(validstring);

            Assert.IsFalse(dictionary.ToString() == string.Empty);
        }
Exemplo n.º 2
0
        public void When_InsertFromRaw_ValidSingleString_Expect_CaseString(string singleString)
        {
            DictionarySearch dictionary = new DictionarySearch();

            dictionary.InsertFromRaw(singleString);

            Assert.IsTrue(dictionary.ToString() == "Case #1: 4433555 555666096667775553\r\n");
        }
Exemplo n.º 3
0
        public void When_InsertFromRaw_ValidMultipleStrings_Expect_CaseString(string multistrings)
        {
            DictionarySearch dictionary = new DictionarySearch();

            dictionary.InsertFromRaw(multistrings);

            Assert.IsFalse(dictionary.ToString() == string.Empty);
        }
Exemplo n.º 4
0
        public void When_InsertFromRaw_InvalidLength_Expect_UserError(string invalidLength)
        {
            DictionarySearch dictionary = new DictionarySearch();

            dictionary.InsertFromRaw(invalidLength);

            Assert.IsTrue(dictionary.ToString().Contains("Invalid length"));
        }
Exemplo n.º 5
0
        public void When_InsertFromRaw_UpperCase_Expect_CaseString(string upperCase)
        {
            DictionarySearch dictionary = new DictionarySearch();

            dictionary.InsertFromRaw(upperCase);

            Assert.IsFalse(dictionary.ToString() == string.Empty);
        }
Exemplo n.º 6
0
        public void When_InsertFromRaw_NoLength_Expect_UserError(string nolengthString)
        {
            DictionarySearch dictionary = new DictionarySearch();

            dictionary.InsertFromRaw(nolengthString);

            Assert.IsTrue(dictionary.ToString().Contains("Length not found"));
        }
Exemplo n.º 7
0
        public void When_InsertFromRaw_LengthWithNoData_Expect_UserError(string noData)
        {
            DictionarySearch dictionary = new DictionarySearch();

            dictionary.InsertFromRaw(noData);

            Assert.IsTrue(dictionary.ToString().Contains("Length provided but data missing"));
        }
Exemplo n.º 8
0
        public void When_InsertFromRaw_PassingInvalid_Expect_EmptyString(string invalidString)
        {
            DictionarySearch dictionary = new DictionarySearch();

            dictionary.InsertFromRaw(invalidString);

            Assert.IsTrue(dictionary.ToString() == string.Empty);
        }
Exemplo n.º 9
0
        public void When_InsertFromRaw_EmptyString_Expect_UserError(string emptystring)
        {
            DictionarySearch dictionary = new DictionarySearch();

            dictionary.InsertFromRaw(emptystring);

            Assert.IsTrue(dictionary.ToString().Contains("Empty string"));
        }
Exemplo n.º 10
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("");
                }
            }
        }
Exemplo n.º 11
0
        public void When_ToString_EmptyObject_Expect_EmptyString()
        {
            DictionarySearch dictionary = new DictionarySearch();

            Assert.IsTrue(dictionary.ToString() == string.Empty);
        }