public void BuildFromComplexTypeWithCustomConverter() { var propertyInfo = GetType().GetProperty("ComplexPropertyWithConverter"); var context = (ReflectionFieldMapper <FieldMappingInfoBuilderTests>)FieldMappingInfoBuilder.Build <FieldMappingInfoBuilderTests>(propertyInfo); Assert.That(context.Converter, Is.InstanceOf <ComplexTypeConverter>()); }
public void OverrideFieldName() { var propertyInfo = GetType().GetProperty("FriendlyName"); var context = FieldMappingInfoBuilder.Build <FieldMappingInfoBuilderTests>(propertyInfo); Assert.That(context.FieldName, Is.EqualTo("ugly_lucene_field_name")); }
public void BuildFromIntProperty() { var propertyInfo = GetType().GetProperty("IntProperty"); var context = (ReflectionFieldMapper <FieldMappingInfoBuilderTests>)FieldMappingInfoBuilder.Build <FieldMappingInfoBuilderTests>(propertyInfo); Assert.That(context.Converter, Is.InstanceOf <Int32Converter>()); }
public void BuildThrowsOnUnconvertableType() { var propertyInfo = GetType().GetProperty("ComplexProperty"); TestDelegate call = () => FieldMappingInfoBuilder.Build <FieldMappingInfoBuilderTests>(propertyInfo); Assert.That(call, Throws.Exception.InstanceOf <NotSupportedException>()); }
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)))); }
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)); }
public void FieldIsPropertyName() { var context = FieldMappingInfoBuilder.Build <FieldMappingInfoBuilderTests>(stringPropertyInfo); Assert.That(context.FieldName, Is.EqualTo(stringPropertyInfo.Name)); }
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)); }
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)); }