public void ConstructorAllowsNullFilter() { var facet = new FilterFacet(ExpectedName, null); Assert.Same(ExpectedName, facet.Name); Assert.Null(facet.Filter); }
public void ConstructorSetsAllProperties() { var facet = new FilterFacet(ExpectedName, expectedFilter); Assert.Same(ExpectedName, facet.Name); Assert.Same(expectedFilter, facet.Filter); }
public static SearchProductProjectionsCommand FilteredFacet(this SearchProductProjectionsCommand command, string alias, Expression <Func <ProductProjection, bool> > expression, bool isCountingProducts = false) { var p = command.SearchParameters as ProductProjectionSearchParameters; var filteredFacet = new FilterFacet <ProductProjection>(expression) { Alias = alias, IsCountingProducts = isCountingProducts }; p.Facets.Add(filteredFacet.ToString()); return(command); }
public void BodyContainsFilterFacet() { var expectedFilter = new ExistsCriteria("IsLocal"); var expectedFacet = new FilterFacet("LocalSales", expectedFilter); var searchRequest = new SearchRequest { Facets = new List <IFacet>(new[] { expectedFacet }) }; var formatter = new SearchRequestFormatter(defaultConnection, mapping, searchRequest); var body = JObject.Parse(formatter.Body); var result = body.TraverseWithAssert("facets", expectedFacet.Name, expectedFacet.Type, expectedFilter.Name, "field"); Assert.Equal(expectedFilter.Field, result.ToString()); }
public void BodyContainsFilterFacetWithQueryFilteredFilter() { var expectedFacet = new FilterFacet("LocalSales", new ExistsCriteria("IsLocal")); var searchRequest = new SearchRequest { Filter = new MissingCriteria("Country"), Query = new PrefixCriteria("Field", "Prefix"), Facets = new List <IFacet>(new[] { expectedFacet }) }; var formatter = new SearchRequestFormatter(defaultConnection, mapping, searchRequest); var body = JObject.Parse(formatter.Body); body.TraverseWithAssert("query", "filtered", "filter", "missing"); body.TraverseWithAssert("facets", expectedFacet.Name, expectedFacet.Type, "exists"); }
protected JToken Build(FilterFacet facet) { return(new JObject()); }
public void TypePropertyIsAlwaysFilter() { var facet = new FilterFacet(ExpectedName, null); Assert.Equal("filter", facet.Type); }