Example #1
0
        public void AddQueryNoParams(bool pNullParams)
        {
            var param = (pNullParams ? null : new Dictionary <string, IWeaverQueryVal>());

            var        r   = new WeaverRequest();
            RequestCmd cmd = r.AddQuery("g", param);

            AssertCmdList(r, 1);
            AssertCmd(cmd, "query", "g");
        }
Example #2
0
        public void ExecuteRequest()
        {
            var r = new WeaverRequest("1234");

            r.AddQuery("g");

            IResponseResult result = r.Execute(RexConnHost, RexConnPort);

            CheckResult(result, "1234", 1, 1);
        }
Example #3
0
        public void AddQueryWeaverScriptNoParams(bool pNullParams)
        {
            var param = (pNullParams ? null : new Dictionary <string, IWeaverQueryVal>());

            var mockScr = new Mock <IWeaverScript>();

            mockScr.SetupGet(x => x.Script).Returns("x");
            mockScr.SetupGet(x => x.Params).Returns(param);

            var        r   = new WeaverRequest();
            RequestCmd cmd = r.AddQuery(mockScr.Object);

            AssertCmdList(r, 1);
            AssertCmd(cmd, "query", "x");
        }
Example #4
0
        public void AddQuery()
        {
            const string script = "g.V('ItemId',P0).outE(P1);";
            var          param  = new Dictionary <string, IWeaverQueryVal>();

            param.Add("P0", new WeaverQueryVal("id"));
            param.Add("P1", new WeaverQueryVal("uses"));

            var        r   = new WeaverRequest();
            RequestCmd cmd = r.AddQuery(script, param);

            const string expectScript    = script;
            const string expectParamJson = "{\"P0\":\"id\",\"P1\":\"uses\"}";

            AssertCmdList(r, 1);
            AssertCmd(cmd, "query", expectScript, expectParamJson);
        }
Example #5
0
        public void AddQueryWeaverScript()
        {
            const string script = "g.V('ItemId',P0).outE(P1);";
            var          param  = new Dictionary <string, IWeaverQueryVal>();

            param.Add("P0", new WeaverQueryVal("id"));
            param.Add("P1", new WeaverQueryVal("uses"));

            var mockScr = new Mock <IWeaverScript>();

            mockScr.SetupGet(x => x.Script).Returns(script);
            mockScr.SetupGet(x => x.Params).Returns(param);

            var        r   = new WeaverRequest();
            RequestCmd cmd = r.AddQuery(mockScr.Object);

            const string expectScript    = script;
            const string expectParamJson = "{\"P0\":\"id\",\"P1\":\"uses\"}";

            AssertCmdList(r, 1);
            AssertCmd(cmd, "query", expectScript, expectParamJson);
        }
Example #6
0
 ////////////////////////////////////////////////////////////////////////////////////////////////
 /*--------------------------------------------------------------------------------------------*/
 public IDataAccess AddQuery(string pScript, bool pCache = false)
 {
     OnCmd(vReq.AddQuery(pScript, null, pCache));
     return(this);
 }