Example #1
0
            public void ShouldParsePath()
            {
                var actual = Parser.ParsePath("<(:A {\"name\": \"A\"})-[:KNOWS {\"value\": 1}]->(:B {\"name\": \"B\"})<-[:KNOWS {\"value\": 2}]-(:C {\"name\": \"C\"})>");

                actual.Nodes.Count.Should().Be(3);
                actual.Relationships.Count.Should().Be(2);

                var labels = actual.Start.Labels;

                labels.Count.Should().Be(1);
                labels.Contains("A").Should().BeTrue();
                var props = actual.Start.Properties;

                props.Count.Should().Be(1);
                props.Keys.Contains("name").Should().BeTrue();
                ((string)props["name"]).Should().Be("A");


                labels = actual.End.Labels;
                labels.Count.Should().Be(1);
                labels.Contains("C").Should().BeTrue();
                props = actual.End.Properties;
                props.Count.Should().Be(1);
                props.Keys.Contains("name").Should().BeTrue();
                ((string)props["name"]).Should().Be("C");

                CypherRecordParser.PathToString(actual).Should().Be("<([A] [[name, A]])-[KNOWS [[value, 1]]]->([B] [[name, B]])<-[KNOWS [[value, 2]]]-([C] [[name, C]])>");
            }
Example #2
0
            public void ShouldParseZeroLengthPath()
            {
                var actual = Parser.ParsePath("<(:A {\"name\": \"A\"})>");
                var labels = actual.Start.Labels;

                labels.Count.Should().Be(1);
                labels.Contains("A").Should().BeTrue();
                var props = actual.Start.Properties;

                props.Count.Should().Be(1);
                props.Keys.Contains("name").Should().BeTrue();
                ((string)props["name"]).Should().Be("A");
                CypherRecordParser.PathToString(actual).Should().Be("<([A] [[name, A]])>");
            }