Exemplo n.º 1
0
        public void ConvertsDateTimeOffsetToSort()
        {
            var orderByClause = new OrderByClause();

            orderByClause.Orderings.Add(new Ordering(new LuceneQueryFieldExpression(typeof(DateTimeOffset?), "Date"), OrderingDirection.Asc));
            mappingInfo.Expect(m => m.GetMappingInfo("Date")).Return(numericMappingInfo);
            numericMappingInfo.Stub(i => i.FieldName).Return("Date");

            transformer.VisitOrderByClause(orderByClause, queryModel, 0);

            Assert.That(transformer.Model.Sort.GetSort().Length, Is.EqualTo(1));
            AssertSortFieldEquals(transformer.Model.Sort.GetSort()[0], "Date", OrderingDirection.Asc, SortField.LONG);
        }
Exemplo n.º 2
0
        public void SetUp()
        {
            mappingInfo = MockRepository.GenerateStub <IFieldMappingInfoProvider>();

            transformer = new QueryModelTranslator(new Context(new RAMDirectory(), new WhitespaceAnalyzer(), Version.LUCENE_29, null, new object()), mappingInfo);

            numericMappingInfo = MockRepository.GenerateStub <IFieldMappingInfo>();
            numericMappingInfo.Stub(i => i.IsNumericField).Return(true);
            numericMappingInfo.Stub(i => i.SortFieldType).Return(SortField.LONG);

            nonNumericMappingInfo = MockRepository.GenerateStub <IFieldMappingInfo>();
            nonNumericMappingInfo.Stub(i => i.IsNumericField).Return(false);
            nonNumericMappingInfo.Stub(i => i.SortFieldType).Return(SortField.STRING);
        }
        public void SetUp()
        {
            mappingInfo = MockRepository.GenerateStub<IFieldMappingInfoProvider>();

            transformer = new QueryModelTranslator(new Context(new RAMDirectory(), new WhitespaceAnalyzer(), Version.LUCENE_29, null, new object()), mappingInfo);

            numericMappingInfo = MockRepository.GenerateStub<IFieldMappingInfo>();
            numericMappingInfo.Stub(i => i.IsNumericField).Return(true);
            numericMappingInfo.Stub(i => i.SortFieldType).Return(SortField.LONG);
            
            nonNumericMappingInfo = MockRepository.GenerateStub<IFieldMappingInfo>();
            nonNumericMappingInfo.Stub(i => i.IsNumericField).Return(false);
            nonNumericMappingInfo.Stub(i => i.SortFieldType).Return(SortField.STRING);
        }