예제 #1
0
        public void New()
        {
            var verts = new List <Type>();
            var edges = new List <Type>();

            var wi = new WeaverInstance(verts, edges);

            Assert.NotNull(wi.Config, "Config should be filled.");
            Assert.AreEqual(verts, wi.Config.VertexTypes, "Incorrect Vertex list.");
            Assert.AreEqual(edges, wi.Config.EdgeTypes, "Incorrect Edge list.");
        }
예제 #2
0
        public void Graph()
        {
            var         wi = new WeaverInstance(new List <Type>(), new List <Type>());
            WeaverGraph g  = (WeaverGraph)wi.Graph;

            Assert.NotNull(g, "Graph should be filled.");
            Assert.NotNull(g.Path, "Graph.Path should be filled.");
            Assert.NotNull(g.Path.Config, "Graph.Path.Config should be filled.");
            Assert.NotNull(g.Path.Query, "Graph.Path.Query should be filled.");

            Assert.AreEqual(1, g.Path.Length, "Incorrect Path length.");
            Assert.AreEqual(g, g.Path.ItemAtIndex(0), "Incorrect Path item.");
        }
예제 #3
0
        public void FromVar()
        {
            const string name = "test";

            var mockVar = new Mock <IWeaverVarAlias <Person> >();

            mockVar.SetupGet(x => x.Name).Returns(name);

            var    wi = new WeaverInstance(new List <Type>(), new List <Type>());
            Person p  = wi.FromVar(mockVar.Object);

            Assert.NotNull(p, "FromVar should be filled.");
            Assert.NotNull(p.Path, "FromVar.Path should be filled.");
            Assert.NotNull(p.Path.Config, "FromVar.Path.Config should be filled.");
            Assert.NotNull(p.Path.Query, "FromVar.Path.Query should be filled.");

            Assert.AreEqual(1, p.Path.Length, "Incorrect Path length.");
            Assert.NotNull((p.Path.ItemAtIndex(0) as WeaverStepCustom), "Incorrect Path item.");
        }
예제 #4
0
        public void HasVciScript()
        {
            var wi = new WeaverInstance(
                new [] { typeof(One), typeof(Two) }, new [] { typeof(OneKnowsTwo) });

            IWeaverQuery q = wi.Graph
                             .V.ExactIndex <Two>(x => x.Id, 10)
                             .InOneKnows
                             .HasNotVci((One x) => x.A)
                             .OutVertex
                             .KnowsTwo
                             .HasVci((Two x) => x.C, WeaverStepHasOp.GreaterThanOrEqualTo, 2)
                             .OutVertex
                             .ToQuery();

            string expect = "g.V('id',_P0).inE('OKT').hasNot('OA').outV" +
                            ".outE('OKT').has('TC',Tokens.T.gte,_P1).outV;";

            Assert.AreEqual(expect, q.Script, "Incorrect script.");
        }
예제 #5
0
 protected virtual void SetUp()
 {
     Schema   = new TestSchema();
     WeavInst = new WeaverInstance(ConfigHelper.VertexTypes, ConfigHelper.EdgeTypes);
 }