public void ShouldDeserializeSubgraphStrategyWithVertexCriterion(int version)
        {
            var vertexCriterionBytecode = new Bytecode();

            vertexCriterionBytecode.AddStep("has", "name", "marko");
            var vertexCriterion  = new TestTraversal(vertexCriterionBytecode);
            var subgraphStrategy = new SubgraphStrategy(vertexCriterion);
            var writer           = CreateGraphSONWriter(version);

            var graphSon = writer.WriteObject(subgraphStrategy);

            const string expected =
                "{\"@type\":\"g:SubgraphStrategy\",\"@value\":{\"vertices\":{\"@type\":\"g:Bytecode\",\"@value\":{\"step\":[[\"has\",\"name\",\"marko\"]]}}}}";

            Assert.Equal(expected, graphSon);
        }
Beispiel #2
0
        public void ShouldSerializeByteCodeWithNestedTraversal(int version)
        {
            var bytecode = new Bytecode();

            bytecode.AddStep("V");
            var nestedBytecode  = new Bytecode();
            var nestedTraversal = new TestTraversal(nestedBytecode);

            nestedBytecode.AddStep("out");
            bytecode.AddStep("repeat", nestedTraversal);
            var graphsonWriter = CreateGraphSONWriter(version);

            var graphSON = graphsonWriter.WriteObject(bytecode);

            var expectedGraphSon =
                "{\"@type\":\"g:Bytecode\",\"@value\":{\"step\":[[\"V\"],[\"repeat\",{\"@type\":\"g:Bytecode\",\"@value\":{\"step\":[[\"out\"]]}}]]}}";

            Assert.Equal(expectedGraphSon, graphSON);
        }