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); } }
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))); }