public void ConstructorAllowsNullFilter() { var facet = new StatisticalFacet(ExpectedName, null, expectedFields); Assert.Same(ExpectedName, facet.Name); Assert.Null(facet.Filter); }
public void ConstructorSetsAllProperties() { var facet = new StatisticalFacet(ExpectedName, expectedFilter, expectedFields); Assert.Same(ExpectedName, facet.Name); Assert.Same(expectedFilter, facet.Filter); Assert.Equal(expectedFields.Length, facet.Fields.Count); }
public void BodyContainsStatisticalFacet() { var expectedFacet = new StatisticalFacet("TotalSales", "OrderTotal"); 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, "field"); Assert.Equal(expectedFacet.Fields[0], result.ToString()); }
protected JToken Build(StatisticalFacet facet) { return(new JObject( BuildFieldProperty(facet.Fields) )); }
public void TypePropertyIsAlwaysStatistical() { var facet = new StatisticalFacet(ExpectedName, expectedFields); Assert.Equal("statistical", facet.Type); }
private static JToken Build(StatisticalFacet statisticalFacet) { return(new JObject( BuildFieldProperty(statisticalFacet.Fields) )); }