예제 #1
0
        public void PTreeReturnsEmptyPageWithWrongPageId()
        {
            _testName = MethodInfo.GetCurrentMethod().Name.GetHashCode().ToString();
            Cleanup();

            var objs = TestResourceFactory.GetMockClassAObjects(50).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", true))
            {
                tree.Load();

                var ids = tree.AddOrUpdateRange(toAdd);
                tree.AddOrUpdate(toAdd.First());

                Assert.AreEqual(50, tree.Length);

                var p = tree.GetPage(8);

                Assert.AreEqual(0, p.Length);
            }
        }