Example #1
0
        public void simple()
        {
            var wf = new WordFetcher();

            string[] result   = wf.GetUniqueWordsOrdered("AA bb CC");
            string[] expected = new string[] { "aa", "bb", "cc" };
            CollectionAssert.AreEqual(expected, result);
        }
Example #2
0
        public void only_get_unique_words()
        {
            var wf = new WordFetcher();

            string[] result   = wf.GetUniqueWordsOrdered("aa bb cc aa bb cc cc cc cc");
            string[] expected = new string[] { "aa", "bb", "cc" };
            CollectionAssert.AreEqual(expected, result);
        }
Example #3
0
        public void empty(string s)
        {
            var wf = new WordFetcher();

            string[] result   = wf.GetUniqueWordsOrdered(s);
            string[] expected = new string[] { };
            CollectionAssert.AreEqual(expected, result);
        }
Example #4
0
        public void ignore_strange_characters()
        {
            var wf = new WordFetcher();

            string[] result   = wf.GetUniqueWordsOrdered("\r\n; ,@  \n aa \" \n\t\n   bb    cc  \t      ");
            string[] expected = new string[] { "aa", "bb", "cc" };
            CollectionAssert.AreEqual(expected, result);
        }
Example #5
0
        public void order_by_word_length_then_alphabetic()
        {
            var wf = new WordFetcher();

            string[] result   = wf.GetUniqueWordsOrdered("ccc aaaa bb cc aaa bbb aa");
            string[] expected = new string[] {
                "aa",
                "bb",
                "cc",
                "aaa",
                "bbb",
                "ccc",
                "aaaa",
            };
            CollectionAssert.AreEqual(expected, result);
        }
Example #6
0
        public void all_in_one()
        {
            var wf = new WordFetcher();

            string[] result   = wf.GetUniqueWordsOrdered("\n    \r  @ \t:  CcC aAAa ccc $$$ bb cc \t AAA bbb aa  \n");
            string[] expected = new string[] {
                "aa",
                "bb",
                "cc",
                "aaa",
                "bbb",
                "ccc",
                "aaaa",
            };
            CollectionAssert.AreEqual(expected, result);
        }