public void AddEdgeVarNoProps() { var rhp = new RootHasPerson(); const string outVarName = "_var0"; const string inVarName = "_var1"; var mockOutVar = new Mock <IWeaverVarAlias>(); mockOutVar.SetupGet(x => x.Name).Returns(outVarName); mockOutVar.SetupGet(x => x.VarType).Returns(typeof(Root)); var mockInVar = new Mock <IWeaverVarAlias>(); mockInVar.SetupGet(x => x.Name).Returns(inVarName); mockInVar.SetupGet(x => x.VarType).Returns(typeof(Person)); IWeaverQuery q = vGraph.AddEdge(mockOutVar.Object, rhp, mockInVar.Object); Assert.True(q.IsFinalized, "Incorrect IsFinalized."); Assert.NotNull(q.Script, "Script should be filled."); Assert.AreEqual(q.Script, "g.addEdge(" + outVarName + "," + inVarName + ",_P0);", "Incorrect Script."); var expectParams = new Dictionary <string, IWeaverQueryVal>(); expectParams.Add("_P0", new WeaverQueryVal(TestSchema.RootHasPerson)); WeaverTestUtil.CheckQueryParamsOriginalVal(q, expectParams); }
public void BuildParameterizedString(WeaverEdgeConn pConn, string pExpectScript) { var mockPath = new Mock <IWeaverPath>(); mockPath.SetupGet(x => x.Config).Returns(WeavInst.Config); var r = new RootHasPerson() { Connection = pConn }; r.Path = mockPath.Object; Assert.AreEqual(pExpectScript, r.BuildParameterizedString(), "Incorrect result."); }
public void AddEdgeNoProps() { var rhp = new RootHasPerson(); var root = new Root { Id = "V0" }; var per = new Person { Id = "eee99" }; IWeaverQuery q = vGraph.AddEdge(root, rhp, per); Assert.True(q.IsFinalized, "Incorrect IsFinalized."); Assert.NotNull(q.Script, "Script should be filled."); Assert.AreEqual("g.addEdge(g.v(_P0),g.v(_P1),_P2);", q.Script, "Incorrect Script."); var expectParams = new Dictionary <string, IWeaverQueryVal>(); expectParams.Add("_P0", new WeaverQueryVal(root.Id)); expectParams.Add("_P1", new WeaverQueryVal(per.Id)); expectParams.Add("_P2", new WeaverQueryVal(TestSchema.RootHasPerson)); WeaverTestUtil.CheckQueryParamsOriginalVal(q, expectParams); }