Esempio n. 1
0
        /*--------------------------------------------------------------------------------------------*/
        public T ElasticIndex <T>(Expression <Func <T, object> > pProperty, string pSpaceDelimitedText)
            where T : IWeaverElement, new()
        {
            var ei = new WeaverStepElasticIndex <T>(pProperty, pSpaceDelimitedText);

            Path.AddItem(ei);
            return(new T {
                Path = Path
            });
        }
Esempio n. 2
0
        /*--------------------------------------------------------------------------------------------*/
        public T ElasticIndex <T>(params IWeaverParamElastic <T>[] pParams)
            where T : IWeaverElement, new()
        {
            var ei = new WeaverStepElasticIndex <T>(pParams);

            Path.AddItem(ei);
            return(new T {
                Path = Path
            });
        }
        public void BuildParameterizedStringText(string pText, string[] pExpect)
        {
            string expect = "";

            for (int i = 0; i < pExpect.Length; ++i)
            {
                expect += (i == 0 ? "" : ".") + "has('" + TestSchema.Vertex_Name + "'," +
                          WeaverParamElastic.ContainsScript + ",_P" + i + ")";
            }

            var ei = new WeaverStepElasticIndex <Person>(x => x.Name, pText);

            ei.Path = vMockPath.Object;

            Assert.AreEqual(expect, ei.BuildParameterizedString(), "Incorrect result.");
        }
        public void BuildParameterizedString(int pCount)
        {
            var    list   = new IWeaverParamElastic <Person> [pCount];
            string expect = "";

            for (int i = 0; i < pCount; ++i)
            {
                string ops = "oper" + i;

                var mockState = new Mock <IWeaverParamElastic <Person> >();
                mockState.SetupGet(x => x.Property).Returns(x => x.PersonId);
                mockState.Setup(x => x.GetOperationScript()).Returns(ops);

                list[i] = mockState.Object;
                expect += (i == 0 ? "" : ".") + "has('" + TestSchema.Person_PersonId + "'," + ops + ",_P" + i + ")";
            }

            var ei = new WeaverStepElasticIndex <Person>(list);

            ei.Path = vMockPath.Object;

            Assert.AreEqual(expect, ei.BuildParameterizedString(), "Incorrect result.");
        }
        public void BuildParameterizedStringFail()
        {
            var se = new WeaverStepElasticIndex <Person>();

            WeaverTestUtil.CheckThrows <WeaverStepException>(true, () => se.BuildParameterizedString());
        }