Пример #1
0
        protected override void ConfigureQueryParser(ElasticQueryParserConfiguration config)
        {
            string dateFixedFieldName = Configuration.Client.Infer.PropertyName(Infer.Property <Stack>(f => f.DateFixed));

            config
            .SetDefaultFields(new[] { "id", Alias.Title, Alias.Description, Alias.Tags, Alias.References })
            .AddVisitor(new StackDateFixedQueryVisitor(dateFixedFieldName));
        }
        [U] public void PropertyName()
        {
            var          fieldFromString = new PropertyName("name");
            var          fieldFromExpressionWithBoost = Infer.Property <Project>(p => p.Name);
            PropertyName propertyInfoField            = typeof(Project).GetProperty(nameof(Project.Name));

            DebugFor(fieldFromString).Should().Be("name");
            DebugFor(fieldFromExpressionWithBoost).Should().Be("p => p.Name typeof: Project");
            DebugFor(propertyInfoField).Should().Be("PropertyInfo: Name typeof: Project");
        }
        [U] public void NotEq()
        {
            PropertyName name = "foo";

            PropertyName[] notEqual = { "bar", "foo  ", "  foo   ", "x", "", "   ", Infer.Property <Project>(p => p.Name) };
            foreach (var t in notEqual)
            {
                (t != name).ShouldBeTrue(t);
                t.Should().NotBe(name);
            }
        }
Пример #4
0
 protected override RoutineBase Routine() =>
 Loop(
     () => Infer.Property <Project>(p => p.LeadDeveloper.FirstName),
     (c, f) => c.Infer.PropertyName(f)
     );
Пример #5
0
        protected override void ConfigureQueryParser(ElasticQueryParserConfiguration config)
        {
            string dateFixedFieldName = Configuration.Client.Infer.PropertyName(Infer.Property <Stack>(f => f.DateFixed));

            config.AddVisitor(new StackDateFixedQueryVisitor(dateFixedFieldName));
        }
        [U] public void TypedNotEq()
        {
            PropertyName t1 = Infer.Property <Developer>(p => p.Id), t2 = Infer.Property <CommitActivity>(p => p.Id);

            (t1 != t2).ShouldBeTrue(t2);
        }
        [U] public void TypedEq()
        {
            PropertyName t1 = Infer.Property <Project>(p => p.Name), t2 = Infer.Property <Project>(p => p.Name);

            (t1 == t2).ShouldBeTrue(t2);
        }
Пример #8
0
 protected override Action <bool> Routine() =>
 Loop(() => Infer.Property <MyProject>(p => p.Person.Name), (c, f) => c.Infer.PropertyName(f));
 protected override RoutineBase Routine() =>
 this.Loop(
     create: () => Infer.Property <Project>(p => p.LeadDeveloper.FirstName),
     act: (c, f) => c.Infer.PropertyName(f)
     );