public static SearchProductProjectionsCommand TermFacet(this SearchProductProjectionsCommand command, string alias, Expression <Func <ProductProjection, IComparable> > expression) { var p = command.SearchParameters as ProductProjectionSearchParameters; var termFacet = new TermFacet <ProductProjection>(expression); termFacet.Alias = alias; p.Facets.Add(termFacet.ToString()); return(command); }
public void ToString_TermFacet() { var term = new TermFacet { Field = "fieldName", Name = "myTermFacet", Size = 3 }; var expected = "\"myTermFacet\":{\"field\":\"fieldName\",\"size\":3}"; var actual = term.ToString().Replace(Environment.NewLine, string.Empty).Replace(" ", string.Empty); Assert.Equal(expected, actual); }
public void ToString_TermFacet() { var term = new TermFacet { Field = "fieldName", Name = "myTermFacet", Size = 3 }; var expected = "\"myTermFacet\":{\"field\":\"fieldName\",\"size\":3}"; var actual = term.ToString().Replace("\r\n", "").Replace(" ", ""); Assert.AreEqual(expected, actual); }