public void WordsWorks()
        {
            TrieTreeNode n = new TrieTreeNode('F');
            n.Add("rog");
            n.Add("ood");
            n.Add("ool");

            Assert.AreEqual(new string[] { "Food", "Fool", "Frog" }, n.Words());
            Assert.AreEqual(new string[] { "Food", "Fool" }, n['o'].Words());
            Assert.AreEqual(new string[] { "Frog" }, n['r'].Words());
            Assert.AreEqual(new string[] { "Frog" }, n['r']['o']['g'].Words());
        }
 public void AddingInvalidStringThrowsException()
 {
     TrieTreeNode n = new TrieTreeNode('P');
     Assert.Throws<ArgumentException>(delegate { n.Add("@-8"); });
 }
 public void AddingValidStringCreatesSubNodes()
 {
     TrieTreeNode n = new TrieTreeNode('F');
     n.Add("ood");
     Assert.AreEqual('o', n['o'].Character);
     Assert.AreEqual("Fo", n['o'].Word);
     Assert.AreEqual('o', n['o']['o'].Character);
     Assert.AreEqual("Foo", n['o']['o'].Word);
     Assert.AreEqual('d', n['o']['o']['d'].Character);
     Assert.AreEqual("Food", n['o']['o']['d'].Word);
 }
 protected TrieTreeNode CreateChild(char childChar)
 {
     childrenCount++;
     TrieTreeNode child = new TrieTreeNode(childChar, this.Word);
     this.children[ArrayIndex(childChar)] = child;
     return child;
 }