public void Constructor_RootNodeReference() { TrieNode <Char> rootNode = null; testCharacterTrie = new CharacterTrie(out rootNode); foreach (String currentTestWord in new List <String>() { "cop", "d", "apple", "apps", "app" }) { testCharacterTrie.Insert(currentTestWord); } Assert.AreEqual(3, rootNode.ChildNodes.Count()); Assert.IsTrue(rootNode.ChildNodeExists('a')); Assert.IsTrue(rootNode.ChildNodeExists('c')); Assert.IsTrue(rootNode.ChildNodeExists('d')); }
public void Constructor_RootNodeReferenceMaintainedAfterClearIsCalled() { TrieNode <Char> rootNode = null; testCharacterTrie = new CharacterTrie(out rootNode); foreach (String currentTestWord in new List <String>() { "cop", "d", "apple", "apps", "app" }) { testCharacterTrie.Insert(currentTestWord); } testCharacterTrie.Clear(); testCharacterTrie.Insert("apple"); Assert.AreEqual(1, rootNode.ChildNodes.Count()); Assert.IsTrue(rootNode.ChildNodeExists('a')); }
protected void SetUp() { testCharacterTrie = new CharacterTrie(); }