예제 #1
0
        public void Traverse()
        {
            // Arrange
            var tree = new TernaryTree(Language.Swedish);
            tree.Add("abe", "abc", "abd");
            var visited = new List<string>();

            // Act
            tree.Traverse(visited.Add);

            // Assert
            var expected = new List<string> { "abc", "abd", "abe" };
            Assert.AreEqual(expected.Count, visited.Count);
            Assert.AreEqual(expected[0], visited[0]);
            Assert.AreEqual(expected[1], visited[1]);
            Assert.AreEqual(expected[2], visited[2]);
        }