public void GetPrecedingSiblingsAndSelf_NullNode_ArgumentNullExceptionThrown()
        {
            // Create a valid ITreeWalker.
            NodeWalker <int> walker = new NodeWalker <int>();

            // Assert that 'GetPrecedingSiblingsAndSelf' throws an 'ArgumentNullException' when the node is null.
            Assert.Throws <ArgumentNullException>("node", () => walker.GetPrecedingSiblingsAndSelf(null).ToArray());
        }
        public void GetPrecedingSiblingsAndSelf_NullWalker_ArgumentNullExceptionThrown()
        {
            // Get a valid tree.
            var tree = TestTreeFactory.GetSimpleTree();

            // Create a null ITreeWalker.
            NodeWalker <int> walker = null;

            // Assert that 'GetPrecedingSiblingsAndSelf' throws an 'ArgumentNullException' when the tree walker
            // is null.
            Assert.Throws <ArgumentNullException>("walker", () => walker.GetPrecedingSiblingsAndSelf(tree).ToArray());
        }
        public void GetPrecedingSiblingsAndSelf(int[] path, int[] expectedResult)
        {
            // Get a valid tree.
            var tree = TestTreeFactory.GetSimpleTree();

            // Get a valid ITreeWalker.
            NodeWalker <int> walker = new NodeWalker <int>();

            foreach (int i in path)
            {
                tree = tree[i];
            }

            // For each node in the tree assert that 'GetPrecedingSiblingsAndSelf' returns the
            // correct elements.
            Assert.Equal(
                expectedResult,
                walker.GetPrecedingSiblingsAndSelf(tree).Select(x => x.Value));
        }