Ejemplo n.º 1
0
        public void InsertingExistingElement_ReturnsSameRoot()
        {
            var items = RandomHelper.UniqueSequence(_random, 100);
            var node  = CreateTree(items);

            foreach (var item in items)
            {
                var result = TwoThreeHelper.Insert(node, item);
                Assert.AreSame(node, result);
            }
        }
Ejemplo n.º 2
0
 private ITwoThree <T> CreateTree <T>(IEnumerable <T> items, IComparer <T> comparer = null)
 {
     return(items.Aggregate((ITwoThree <T>)EmptyTwoThree <T> .Instance, (current, item) => TwoThreeHelper.Insert(current, item, comparer)));
 }