public static uint GetOrGetNext(this FixedSizeNode <SnapUInt32, SnapUInt32> tree, uint key)
        {
            SnapUInt32 k = new SnapUInt32(key);
            SnapUInt32 v = new SnapUInt32();

            tree.GetOrGetNext(k, v);
            return(v.Value);
        }
        public void Test_CreateRootNode_Get()
        {
            uint rootKey   = 0;
            byte rootLevel = 0;

            uint        nextKeyIndex = 0;
            Func <uint> getNextKey   = () =>
            {
                nextKeyIndex++;
                return(nextKeyIndex - 1);
            };
            Action <SnapUInt32, uint, byte> addToParent  = (int32, u, arg3) => int32 = int32;
            Func <SnapUInt32, uint>         findLeafNode = int32 => 0;

            Stopwatch swWrite = new Stopwatch();
            Stopwatch swRead  = new Stopwatch();

            using (BinaryStream bs = new BinaryStream())
            {
                uint k, v;
                FixedSizeNode <SnapUInt32, SnapUInt32> node = new FixedSizeNode <SnapUInt32, SnapUInt32>(0);

                node.Initialize(bs, 1024, getNextKey, null);

                node.CreateEmptyNode(0);
                node.Insert(1, 100);
                node.Insert(2, 200);

                Assert.AreEqual(0u, node.NodeIndex);
                Assert.AreEqual(uint.MaxValue, node.LeftSiblingNodeIndex);
                Assert.AreEqual(uint.MaxValue, node.RightSiblingNodeIndex);

                Assert.AreEqual(1u, node.GetFirstKey());
                Assert.AreEqual(100u, node.GetFirstValue());
                Assert.AreEqual(2u, node.GetLastKey());
                Assert.AreEqual(200u, node.GetLastValue());

                Assert.AreEqual(100u, node.Get(1));
                Assert.AreEqual(200u, node.Get(2));
                Assert.AreEqual(100u, node.GetOrGetNext(1));
                Assert.AreEqual(200u, node.GetOrGetNext(2));
                Assert.AreEqual(200u, node.GetOrGetNext(3));

                node.SetNodeIndex(0);

                Assert.AreEqual(0u, node.NodeIndex);
                Assert.AreEqual(uint.MaxValue, node.LeftSiblingNodeIndex);
                Assert.AreEqual(uint.MaxValue, node.RightSiblingNodeIndex);

                Assert.AreEqual(1u, node.GetFirstKey());
                Assert.AreEqual(100u, node.GetFirstValue());
                Assert.AreEqual(2u, node.GetLastKey());
                Assert.AreEqual(200u, node.GetLastValue());

                Assert.AreEqual(100u, node.Get(1));
                Assert.AreEqual(200u, node.Get(2));
                Assert.AreEqual(100u, node.GetOrGetNext(1));
                Assert.AreEqual(200u, node.GetOrGetNext(2));
                Assert.AreEqual(200u, node.GetOrGetNext(3));
            }
        }