private void AssertValid <T>(ITwoThree <T> tree)
        {
            var values = tree.GetValues().ToArray();

            Assert.True(tree.IsBalanced());
            CollectionAssert.IsOrdered(values);
            CollectionAssert.AllItemsAreUnique(values);
        }
Beispiel #2
0
        // ITwoThree

        public IEnumerable <T> GetValues()
        {
            foreach (var value in Left.GetValues())
            {
                yield return(value);
            }

            yield return(Value);

            foreach (var value in Right.GetValues())
            {
                yield return(value);
            }
        }
        // ITwoThree

        public IEnumerable <T> GetValues()
        {
            foreach (var value in Left.GetValues())
            {
                yield return(value);
            }

            yield return(First);

            foreach (var value in Middle.GetValues())
            {
                yield return(value);
            }

            yield return(Second);

            foreach (var value in Right.GetValues())
            {
                yield return(value);
            }
        }
 public IEnumerator <T> GetEnumerator()
 {
     return(_root.GetValues().GetEnumerator());
 }
 public IEnumerator <KeyValuePair <TKey, TValue> > GetEnumerator()
 {
     return(_root.GetValues().GetEnumerator());
 }