示例#1
0
        public void ConvertsToSort()
        {
            var orderByClause = new OrderByClause();

            orderByClause.Orderings.Add(new Ordering(new LuceneQueryFieldExpression(typeof(string), "Name"), OrderingDirection.Asc));
            mappingInfo.Expect(m => m.GetMappingInfo("Name")).Return(nonNumericMappingInfo);
            nonNumericMappingInfo.Stub(i => i.FieldName).Return("Name");

            transformer.VisitOrderByClause(orderByClause, queryModel, 0);

            Assert.That(transformer.Model.Sort.GetSort().Length, Is.EqualTo(1));
            AssertSortFieldEquals(transformer.Model.Sort.GetSort()[0], "Name", OrderingDirection.Asc, SortField.STRING);
        }
示例#2
0
        public void SetsQueryFilterOnKeyField()
        {
            mappingProvider.Expect(m => m.KeyProperties).Return(new[] { "MyProp" });
            mappingProvider.Expect(m => m.GetMappingInfo("MyProp")).Return(
                new FakeFieldMappingInfo {
                FieldName = "my-key"
            });

            transformer.Build(queryModel);

            var filter = (QueryWrapperFilter)transformer.Model.Filter;

            Assert.That(filter, Is.Not.Null, "transformer.Model.Filter");
            Assert.That(filter.ToString(), Is.EqualTo("QueryWrapperFilter(+my-key:*)"));
        }