Exemplo n.º 1
0
        public void BuildFromComplexTypeWithCustomConverter()
        {
            var propertyInfo = GetType().GetProperty("ComplexPropertyWithConverter");
            var context      = (ReflectionFieldMapper <FieldMappingInfoBuilderTests>)FieldMappingInfoBuilder.Build <FieldMappingInfoBuilderTests>(propertyInfo);

            Assert.That(context.Converter, Is.InstanceOf <ComplexTypeConverter>());
        }
Exemplo n.º 2
0
        public void OverrideFieldName()
        {
            var propertyInfo = GetType().GetProperty("FriendlyName");
            var context      = FieldMappingInfoBuilder.Build <FieldMappingInfoBuilderTests>(propertyInfo);

            Assert.That(context.FieldName, Is.EqualTo("ugly_lucene_field_name"));
        }
Exemplo n.º 3
0
        public void BuildFromIntProperty()
        {
            var propertyInfo = GetType().GetProperty("IntProperty");
            var context      = (ReflectionFieldMapper <FieldMappingInfoBuilderTests>)FieldMappingInfoBuilder.Build <FieldMappingInfoBuilderTests>(propertyInfo);

            Assert.That(context.Converter, Is.InstanceOf <Int32Converter>());
        }
Exemplo n.º 4
0
        public void BuildThrowsOnUnconvertableType()
        {
            var          propertyInfo = GetType().GetProperty("ComplexProperty");
            TestDelegate call         = () => FieldMappingInfoBuilder.Build <FieldMappingInfoBuilderTests>(propertyInfo);

            Assert.That(call, Throws.Exception.InstanceOf <NotSupportedException>());
        }
Exemplo n.º 5
0
        public void RetainsPropertyInfo()
        {
            var context = (ReflectionFieldMapper <FieldMappingInfoBuilderTests>)FieldMappingInfoBuilder.Build <FieldMappingInfoBuilderTests>(stringPropertyInfo);

            Assert.That(context.PropertyName, Is.EqualTo(stringPropertyInfo.Name));
            Assert.That(context.PropertyInfo, Is.EqualTo(stringPropertyInfo));
        }
        public void BuildFromIntProperty()
        {
            var propertyInfo = GetType().GetProperty("IntProperty");
            var context      = FieldMappingInfoBuilder.Build <FieldMappingInfoBuilderTests>(propertyInfo);

            Assert.That(context.Converter, Is.EqualTo(TypeDescriptor.GetConverter(typeof(int))));
        }
Exemplo n.º 7
0
 private ReflectionFieldMapper <FieldMappingInfoBuilderAnalyzerTests> Build(string propertyName)
 {
     return((ReflectionFieldMapper <FieldMappingInfoBuilderAnalyzerTests>)FieldMappingInfoBuilder
            .Build <FieldMappingInfoBuilderAnalyzerTests>(
                GetType()
                .GetProperty(propertyName),
                Version.LUCENE_30,
                null));
 }
        private IFieldMapper <FieldMappingInfoBuilderDateFormatTests> CreateMapper <T>(Expression <Func <T> > expression)
        {
            var info = ((MemberExpression)expression.Body).Member;

            return(FieldMappingInfoBuilder.Build <FieldMappingInfoBuilderDateFormatTests>((PropertyInfo)info));
        }
 private IFieldMapper <FieldMappingInfoBuilderSortFieldTests> CreateMapper(PropertyInfo propertyInfo)
 {
     return(FieldMappingInfoBuilder.Build <FieldMappingInfoBuilderSortFieldTests>(propertyInfo));
 }
Exemplo n.º 10
0
        public void FieldIsPropertyName()
        {
            var context = FieldMappingInfoBuilder.Build <FieldMappingInfoBuilderTests>(stringPropertyInfo);

            Assert.That(context.FieldName, Is.EqualTo(stringPropertyInfo.Name));
        }
Exemplo n.º 11
0
        public void UsesExternalAnalyzerWhenProvided()
        {
            var externalAnalyzer = new StandardAnalyzer(Version.LUCENE_30);

            var mapper = (ReflectionFieldMapper <FieldMappingInfoBuilderAnalyzerTests>)FieldMappingInfoBuilder
                         .Build <FieldMappingInfoBuilderAnalyzerTests>(
                GetType().GetProperty("Simple"),
                Version.LUCENE_30,
                externalAnalyzer);

            Assert.That(mapper.Analyzer, Is.SameAs(externalAnalyzer));
        }
 private IFieldMapper <FieldMappingInfoBuilderCollectionComplexTypeTests> CreateMapper()
 {
     return(FieldMappingInfoBuilder.Build <FieldMappingInfoBuilderCollectionComplexTypeTests>(info));
 }
 private IFieldMapper <FieldMappingInfoBuilderScoreTests> CreateMapper()
 {
     return(FieldMappingInfoBuilder.Build <FieldMappingInfoBuilderScoreTests>(info));
 }
 private IFieldMapper <FieldMappingInfoBuilderDateFormatTests> CreateMapper(string propertyName, out PropertyInfo info)
 {
     info = GetType().GetProperty(propertyName);
     return(FieldMappingInfoBuilder.Build <FieldMappingInfoBuilderDateFormatTests>(info));
 }
Exemplo n.º 15
0
        public void NoConverterForStrings()
        {
            var context = (ReflectionFieldMapper <FieldMappingInfoBuilderTests>)FieldMappingInfoBuilder.Build <FieldMappingInfoBuilderTests>(stringPropertyInfo);

            Assert.That(context.Converter, Is.Null, "No converter should be necessary for typeof(string)");
        }
 private IFieldMapper <FieldMappingInfoBuilderNumericDateTimeTests> CreateMapper()
 {
     return(FieldMappingInfoBuilder.Build <FieldMappingInfoBuilderNumericDateTimeTests>(info));
 }
        public void RetainsPropertyInfo()
        {
            var context = FieldMappingInfoBuilder.Build <FieldMappingInfoBuilderTests>(stringPropertyInfo);

            Assert.That(context.PropertyInfo, Is.SameAs(stringPropertyInfo));
        }