Beispiel #1
0
        public void Has(HasStepType pStepType)
        {
            OneKnowsTwo result = DoHasStep <OneKnowsTwo, One>(pStepType, x => x.A);

            Assert.NotNull(result, "Result should be filled.");
            vMockPath.Verify(x => x.AddItem(It.IsAny <WeaverStepHas <One> >()), Times.Once());
        }
Beispiel #2
0
        public void AddEdgeVci()
        {
            vMockPath.SetupGet(x => x.Query).Returns(new WeaverQuery());             //should mock this

            var okt = new OneKnowsTwo();

            okt.FirstProp  = "test";
            okt.SecondProp = 998877;

            const string perId = "a99";
            const string twoId = "x1234";

            var one = new One {
                Id = perId
            };
            var two = new Two {
                Id = twoId
            };

            IWeaverQuery q = vGraph.AddEdgeVci(one, okt, two);

            Console.WriteLine(q.Script);

            const string expect =
                "_A=g.v(_P0);" +
                "_B=g.v(_P1);" +
                "_PROP=[First:_P3,Second:_P4];" +
                "_TRY=[OA:_A,OD:_A,TB:_B,TC:_B,TD:_B];" +
                TryScript +
                "g.addEdge(_A,_B,_P2,_PROP);";

            Assert.True(q.IsFinalized, "Incorrect IsFinalized.");
            Assert.NotNull(q.Script, "Script should be filled.");
            Assert.AreEqual(expect, q.Script, "Incorrect starting code.");

            ////

            var expectParams = new Dictionary <string, IWeaverQueryVal>();

            expectParams.Add("_P0", new WeaverQueryVal(one.Id));
            expectParams.Add("_P1", new WeaverQueryVal(two.Id));
            expectParams.Add("_P2", new WeaverQueryVal("OKT"));
            expectParams.Add("_P3", new WeaverQueryVal(okt.FirstProp));
            expectParams.Add("_P4", new WeaverQueryVal(okt.SecondProp));
            WeaverTestUtil.CheckQueryParamsOriginalVal(q, expectParams);
        }