public void TestKey()
    {
        var itemWithoutScope = new DefaultMetadata()
        {
            Path = ""
        };
        var itemWithScope = new DefaultMetadata()
        {
            Path = "", Scope = ""
        };
        var itemWithNamedScope = new DefaultMetadata()
        {
            Path = "", Scope = "posts"
        };
        var itemPathWithNameScope = new DefaultMetadata()
        {
            Path = "2019", Scope = "posts"
        };

        var data = new DefaultMetadatas
        {
            itemWithoutScope,
            itemWithScope,
            itemWithNamedScope,
            itemPathWithNameScope
        };

        data[""].Should().NotBeNull();
        data["."].Should().NotBeNull();
        data[".posts"].Should().NotBeNull();
        data["2019.posts"].Should().NotBeNull();
    }
Пример #2
0
        public void ExecuteOperation()
        {
            var chain = new TransactionChain();

            chain.TransactionCompleted += ChainOnTransactionCompleted;
            INode         newNode = MapManager.CreateNode(Map.DomainId, Map.RootMapId.Value, NodeType, string.Empty, ref chain);
            IRelationship newMapContainerRelationship = MapManager.CreateRelationship(Map.DomainId, Map.RootMapId.Value, MapContainerRelationshipType, string.Empty, ref chain);

            newMapContainerRelationship.ConnectNode(FromConnectionType, newNode, ref chain);
            newMapContainerRelationship.ConnectNode(ToConnectionType, Map, ref chain);

            newNode.Metadata.Add(newMapContainerRelationship, FromConnectionType, "XPosition", X.ToString(), ref chain);
            newNode.Metadata.Add(newMapContainerRelationship, FromConnectionType, "YPosition", Y.ToString(), ref chain);
            newNode.Metadata.Add(newMapContainerRelationship, FromConnectionType, "CollapseState", "None", ref chain);
            newNode.Metadata.Add(newMapContainerRelationship, FromConnectionType, "Visibility", "Visible", ref chain);

            if (DefaultMetadata != null)
            {
                if (!DefaultMetadata.ContainsKey("Name"))
                {
                    newNode.Metadata.Add(null, null, "Name", string.Empty, ref chain);
                }
                foreach (var valuePair in DefaultMetadata)
                {
                    newNode.Metadata.Add(null, null, valuePair.Key, valuePair.Value, ref chain);
                }
            }
            else
            {
                newNode.Metadata.Add(null, null, "Name", string.Empty, ref chain);
            }

            Response = new InProcessTransactionResponse();
            Response.Nodes.Add(newNode);
            Response.Relationships.Add(newMapContainerRelationship);

            MapManager.ExecuteTransaction(chain);
        }