예제 #1
0
        public void ConstructorAllowsNullFilter()
        {
            var facet = new StatisticalFacet(ExpectedName, null, expectedFields);

            Assert.Same(ExpectedName, facet.Name);
            Assert.Null(facet.Filter);
        }
예제 #2
0
        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());
        }
 static JToken Build(StatisticalFacet statisticalFacet)
 {
     return new JObject(
         BuildFieldProperty(statisticalFacet.Fields)
     );
 }
예제 #5
0
        public void TypePropertyIsAlwaysStatistical()
        {
            var facet = new StatisticalFacet(ExpectedName, expectedFields);

            Assert.Equal("statistical", facet.Type);
        }