public void ApplyToQuery_EqualsNestedNestedText_CorrectResultReturned() { var criteria = new TextSearch(); criteria.Property = "Nested.Nested.TextNested"; criteria.TargetTypeName = typeof(SomeClass).AssemblyQualifiedName; criteria.SearchTerm = "qwerty"; criteria.Comparator = TextComparators.Equals; Assert.Equal(0, criteria.ApplyToQuery(new Repository().GetQuery()).Count()); }
public void Children_Contains_Succeeds() { var search = new TextSearch($"{nameof(Foo.Bars)}.{nameof(Bar.Value)}") { Is = TextSearch.Comparer.Contains, Term = "Ba" }; var result = search.ApplyToQuery(Foos2().AsQueryable()).ToArray(); result.Length.Should().Be(1); result[0].Id.Should().Be(6); }
public void Multiple_Contains_Succeeds() { var search = new TextSearch(nameof(Baz.Value1), nameof(Baz.Value2)) { Term = "Bar", Is = TextSearch.Comparer.Contains }; var result = search.ApplyToQuery(Bazes().AsQueryable()).ToArray(); result.Length.Should().Be(2); result[0].Id.Should().Be(1); result[1].Id.Should().Be(2); }
public void Contains_Succeeds() { var search = new TextSearch(nameof(Item.Value)) { Term = "Ba", Is = TextSearch.Comparer.Contains }; var result = search.ApplyToQuery(Items().AsQueryable()).ToArray(); result.Length.Should().Be(2); result[0].Id.Should().Be(2); result[1].Id.Should().Be(3); }
public void Child_Equals_Succeeds() { Expression <Func <Foo, object> > expression = foo => foo.Bar.Value; var property = expression.GetPropertyPath(); var search = new TextSearch(property) { Is = TextSearch.Comparer.Equals, Term = "Baz" }; var result = search.ApplyToQuery(Foos().AsQueryable()).ToArray(); result.Length.Should().Be(1); result[0].Id.Should().Be(5); }