コード例 #1
0
        public void TestSingularAddToTree()
        {
            string       text = "content";
            CityTreeNode tree = new CityTreeNode();

            tree.Add(text);

            string result = tree.GetEntries(1)[0];

            Assert.AreEqual(result, text);
        }
コード例 #2
0
        public void TestInvalidLetterSuggestions()
        {
            List <string> text = new List <string>(new string[] { "abcdef", "abd", "acdef" });
            CityTreeNode  tree = new CityTreeNode();

            text.ForEach(content => tree.Add(content));

            string        search      = "z";
            List <string> nextLetters = tree.GetNextLetters(search);

            CollectionAssert.AreEqual(new List <string>(), nextLetters);
        }
コード例 #3
0
        public void TestMultipleAddToTree()
        {
            List <string> text = new List <string>(new string[] { "content", "john smith", "test" });
            CityTreeNode  tree = new CityTreeNode();

            text.ForEach(content => tree.Add(content));

            List <string> results = tree.GetEntries(3);

            foreach (string result in results)
            {
                Assert.AreEqual(true, text.Contains(result));
            }
        }