示例#1
0
        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);
        }
示例#2
0
        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);
        }
示例#3
0
        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);
        }