コード例 #1
0
        public void Get_Node_Caches_Node()
        {
            var node        = _provider.CreateNode(2);
            var newProvider = new RecordBTreeDataProvider <object>(
                _session,
                _manager,
                new BTreeNodeBsonSerializer <object>(),
                "Root");

            node = newProvider.GetNode(node.Address); // get with new provider
            node.ChildrenAddresses.Add(12);
            node = newProvider.GetNode(node.Address); //get it again
            Assert.AreEqual(12, node.ChildrenAddresses[0]);
        }
コード例 #2
0
        public void Unlinked_Nodes_Are_Removed_From_Total()
        {
            var rootNode = _provider.GetRootNode(2);
            var node1    = _provider.CreateNode(2);
            var node2    = _provider.CreateNode(2);

            rootNode.ChildrenAddresses.Add(node1.Address);
            rootNode.ChildrenAddresses.Add(node2.Address);
            _provider.Flush();

            var newProvider = new RecordBTreeDataProvider <object>(
                _session,
                _manager,
                new BTreeNodeBsonSerializer <object>(),
                "Root");

            rootNode = newProvider.GetRootNode(2);
            newProvider.GetNode(node2.Address);
            rootNode.ChildrenAddresses.RemoveRange(1, 1);
            newProvider.Flush();

            newProvider = new RecordBTreeDataProvider <object>(
                _session,
                _manager,
                new BTreeNodeBsonSerializer <object>(),
                "Root");

            Assert.AreEqual(2, newProvider.MetaRecord.NumberOfNodes);
        }
コード例 #3
0
        public void Create_Node_Caches_Loaded_Nodes()
        {
            var node = _provider.CreateNode(2);

            node.ChildrenAddresses.Add(12);
            node = _provider.GetNode(node.Address);
            Assert.AreEqual(12, node.ChildrenAddresses[0]);
        }
コード例 #4
0
        public void Get_Node_Loads_From_Record()
        {
            var node         = _provider.CreateNode(2);
            var dataProvider = new RecordBTreeDataProvider <object>(
                _session,
                _manager,
                new BTreeNodeBsonSerializer <object>(),
                "Root");
            var loadedNode = dataProvider.GetNode(node.Address);

            Assert.AreEqual(node.Address, loadedNode.Address);
        }