public void PTreePushesLotsOfDuplicateEntities() { _testName = MethodInfo.GetCurrentMethod().Name.GetHashCode().ToString(); Cleanup(); var objs = TestResourceFactory.GetMockClassAObjects(5000).ToList(); var seedIndex = new Seed32(); var seedSegment = new Seed64(); objs.ForEach(o => o.Id = seedIndex.Increment()); var toAdd = objs.Select(o => new Tuple<MockClassA, long>(o, seedSegment.Increment())).ToList(); using (var tree = new PTree<int, MockClassA, long>("Id", _testName + ".index")) { tree.Load(); var ids = tree.AddOrUpdateRange(toAdd); Assert.AreEqual(5000, tree.Length); Assert.AreEqual(5, tree.GetFirstByIndex(5)); Assert.AreEqual(5, tree.GetFirstBySegment(5)); Assert.AreEqual(1, tree.GetByIndex(5).Count()); tree.AddOrUpdate(new Tuple<MockClassA, long>(TestResourceFactory.CreateRandom().WithId(seedIndex.Increment()), seedSegment.Increment())); Assert.AreEqual(5001, tree.Length); tree.AddOrUpdateRange(toAdd.Skip(100).Take(100).ToList()); Assert.AreEqual(5101, tree.Length); Assert.AreEqual(2, tree.GetBySegment(toAdd[101].Item2).Count()); } }