Beispiel #1
0
        /*--------------------------------------------------------------------------------------------*/
        private void CheckBuildEdge(IWeaverPathPipeEnd pResult, IEnumerable <string> pOptional,
                                    string pDbName)
        {
            Assert.NotNull(pResult, "Result should be filled.");

            var expect = new List <string>(new[] {
                "makeType()",
                "name(_P0)",
            });

            expect.AddRange(pOptional);
            expect.Add("makeEdgeLabel()");

            Assert.AreEqual(expect.Count, vPathItems.Count, "Incorrect PathItems.Count.");

            for (int i = 0; i < expect.Count; ++i)
            {
                string script = vPathItems[i].BuildParameterizedString();
                Console.WriteLine("Script " + i + ": " + script);
                Assert.AreEqual(expect[i], script, "Incorrect PathItem script at index " + i + ".");
            }

            Assert.AreEqual(1, vQueryVals.Count, "Incorrect QueryVals.Count.");
            Assert.AreEqual(pDbName, vQueryVals[0].Original, "Incorrect QueryVals[0] value.");
        }
Beispiel #2
0
        public void Property()
        {
            IWeaverPathPipeEnd result = vElem.Property(x => x.Value);

            Assert.NotNull((result as WeaverStepProp <TestElement>), "Incorrect result.");
            vElem.MockPath.Verify(x => x.AddItem(It.IsAny <WeaverStepProp <TestElement> >()), Times.Once());
        }
Beispiel #3
0
        public void MakeEdgePropertyKey()
        {
            IWeaverPathPipeEnd end =
                vGraph.MakeEdgePropertyKey <TitanPersonKnowsTitanPerson>(x => x.Amount);

            var expect = new[] {
                "indexed(Edge.class)",
                "indexed('search',Edge.class)"
            };

            CheckMakeProperty(end, expect, TestSchema.PersonKnowsPerson_Amount, "Float");
        }
Beispiel #4
0
        public void BuildEdgeLabelMax()
        {
            IWeaverPathPipeEnd end = vGraph.BuildEdgeLabel <OneKnowsTwo>(n => new WeaverVarAlias(n));

            var expect = new[] {
                "primaryKey(OA,OD,TB,TC,TD)",
                "signature(OB,OC,OE,TiNa,TA,TE)",
                "unique(IN)",
                "unique(OUT)"
            };

            CheckBuildEdge(end, expect, "OKT");
        }
Beispiel #5
0
        public void MakeVertexPropertyKeyMax()
        {
            const string groupName = "_MyGroup";

            var mockGroup = new Mock <IWeaverVarAlias>();

            mockGroup.SetupGet(x => x.Name).Returns(groupName);

            IWeaverPathPipeEnd end =
                vGraph.MakeVertexPropertyKey <TitanPerson>(x => x.Age, mockGroup.Object);

            var expect = new[] {
                "group(" + groupName + ")",
                "indexed(Vertex.class)",
                "indexed('search',Vertex.class)"
            };

            CheckMakeProperty(end, expect, TestSchema.Person_Age, "Float");
        }
Beispiel #6
0
        public void BuildEdgeLabelMin()
        {
            IWeaverPathPipeEnd end = vGraph.BuildEdgeLabel <EmptyHasEmpty>(p => null);

            CheckBuildEdge(end, new string[0], "EHE");
        }
Beispiel #7
0
        public void MakeVertexPropertyKeyNullable()
        {
            IWeaverPathPipeEnd end = vGraph.MakeVertexPropertyKey <NullableProp>(x => x.A);

            CheckMakeProperty(end, new string[0], "A", "Integer");
        }
Beispiel #8
0
        public void MakeVertexPropertyKeyMin()
        {
            IWeaverPathPipeEnd end = vGraph.MakeVertexPropertyKey <TitanPerson>(x => x.IsMale);

            CheckMakeProperty(end, new string[0], TestSchema.Person_IsMale, "Boolean");
        }