public void can_find_a_converter_for_HttpPostedFileBase() { var registry = new ValueConverterRegistry(new IConverterFamily[0]); var property = ReflectionHelper.GetProperty<ModelWithHttpPostedFileBase>(x => x.File); registry.FindConverter(property).ShouldNotBeNull(); }
public void should_convert_nonnull_values_for_nullable_types() { PropertyInfo nullIntProp = ReflectionHelper.GetProperty<Target>(x => x.NullInt); var reg = new ValueConverterRegistry(new IConverterFamily[0]); var value = new InMemoryBindingContext().WithPropertyValue("99"); reg.FindConverter(nullIntProp)(value).ShouldEqual(99); }
public void SetUp() { var converterRegistry = new ValueConverterRegistry(new IConverterFamily[]{new EntityPropertyConverter()}, new ConverterLibrary()); binder = new StandardModelBinder( new PropertyBinderCache(new IPropertyBinder[0], converterRegistry, new DefaultCollectionTypeProvider()), new TypeDescriptorCache()); }
public void should_convert_nonnull_values_for_nullable_types() { PropertyInfo nullIntProp = ReflectionHelper.GetProperty <Target>(x => x.NullInt); var reg = new ValueConverterRegistry(new IConverterFamily[0]); var value = new InMemoryBindingContext().WithPropertyValue("99"); reg.FindConverter(nullIntProp)(value).ShouldEqual(99); }
public void can_find_a_converter_for_a_system_property() { var registry = new ValueConverterRegistry(new IConverterFamily[0]); var property = ReflectionHelper.GetProperty <ModelWithHttpPostedFileBase>(x => x.AcceptTypes); registry.FindConverter(property).ShouldNotBeNull(); }
public void should_convert_null_values_for_nullable_types() { PropertyInfo nullIntProp = ReflectionHelper.GetProperty<Target>(x => x.NullInt); var reg = new ValueConverterRegistry(new IConverterFamily[0], new ConverterLibrary()); var value = new InMemoryBindingContext().WithPropertyValue(null); value.ForProperty(nullIntProp, c => { reg.FindConverter(nullIntProp).Convert(c).ShouldEqual(null); }); }
public void should_convert_null_values_for_nullable_types() { PropertyInfo nullIntProp = ReflectionHelper.GetProperty<Target>(x => x.NullInt); var reg = new ValueConverterRegistry(new IConverterFamily[0]); var value = new RawValue { Property = nullIntProp, Value = null }; reg.FindConverter(nullIntProp)(value).ShouldEqual(null); }
public void SetUp() { _registry = new ValueConverterRegistry(new IConverterFamily[0]); _property = typeof(HttpRequestBase).GetProperty("Browser"); _aspNetObjectConversionFamily = _registry.Families.SingleOrDefault(cf => cf.Matches(_property)) as ASPNetObjectConversionFamily; _aspNetObjectConversionFamily.ShouldNotBeNull(); _context = MockRepository.GenerateMock<IPropertyContext>(); _propertyValue = new object(); _context.Expect(c => c.PropertyValue).Return(_propertyValue); }
public void should_convert_null_values_for_nullable_types() { PropertyInfo nullIntProp = ReflectionHelper.GetProperty <Target>(x => x.NullInt); var reg = new ValueConverterRegistry(new IConverterFamily[0], new ConverterLibrary()); var value = new InMemoryBindingContext().WithPropertyValue(null); value.ForProperty(nullIntProp, c => { reg.FindConverter(nullIntProp).Convert(c).ShouldEqual(null); }); }
public void SetUp() { _registry = new ValueConverterRegistry(new IConverterFamily[0]); _property = typeof(PropertyHolder).GetProperty("Property"); _basicTypeConverter = _registry.Families.SingleOrDefault(cf => cf.Matches(_property)) as BasicTypeConverter; _basicTypeConverter.ShouldNotBeNull(); _context = MockRepository.GenerateMock <IPropertyContext>(); _propertyValue = "some value"; _context.Expect(c => c.PropertyValue).Return(_propertyValue).Repeat.Times(3); }
public void SetUp() { _registry = new ValueConverterRegistry(new IConverterFamily[0]); _property = typeof(PropertyHolder).GetProperty("Property"); _numericTypeFamily = _registry.Families.FirstOrDefault(cf => cf.Matches(_property)) as NumericTypeFamily; _numericTypeFamily.ShouldNotBeNull(); _context = MockRepository.GenerateMock <IPropertyContext>(); _propertyValue = "1,000.001"; _context.Expect(c => c.PropertyValue).Return(_propertyValue).Repeat.Times(4); }
public void SetUp() { _registry = new ValueConverterRegistry(new IConverterFamily[0]); _property = typeof(HttpRequestBase).GetProperty("Browser"); _aspNetObjectConversionFamily = _registry.Families.SingleOrDefault(cf => cf.Matches(_property)) as ASPNetObjectConversionFamily; _aspNetObjectConversionFamily.ShouldNotBeNull(); _context = MockRepository.GenerateMock <IBindingContext>(); _propertyValue = new object(); _context.Expect(c => c.PropertyValue).Return(_propertyValue); }
public void SetUp() { _registry = new ValueConverterRegistry(new IConverterFamily[0]); _property = typeof(PropertyHolder).GetProperty("Property"); _basicTypeConverter = _registry.Families.SingleOrDefault(cf => cf.Matches(_property)) as BasicTypeConverter; _basicTypeConverter.ShouldNotBeNull(); _context = MockRepository.GenerateMock<IBindingContext>(); _propertyValue = "some value"; _context.Expect(c => c.PropertyValue).Return(_propertyValue).Repeat.Times(3); }
public void SetUp() { theLibrary = new ConverterLibrary(); _registry = new ValueConverterRegistry(new IConverterFamily[0], theLibrary); _property = typeof (PropertyHolder).GetProperty("Property"); _basicConverterFamily = _registry.Families.SingleOrDefault(cf => cf.Matches(_property)) as BasicConverterFamily; _basicConverterFamily.ShouldNotBeNull(); _context = MockRepository.GenerateMock<IPropertyContext>(); _context.Stub(x => x.Property).Return(_property); _propertyValue = "some value"; _context.Expect(c => c.PropertyValue).Return(_propertyValue).Repeat.Times(3); }
public void SetUp() { _registry = StructureMapContainerFacility.GetBasicFubuContainer().GetInstance<IValueConverterRegistry>().As <ValueConverterRegistry>(); _property = typeof(HttpRequestBase).GetProperty("Browser"); _aspNetObjectConversionFamily = _registry.Families.SingleOrDefault(cf => cf.Matches(_property)) as AspNetObjectConversionFamily; _aspNetObjectConversionFamily.ShouldNotBeNull(); _context = MockRepository.GenerateMock<IPropertyContext>(); _propertyValue = new object(); _context.Expect(c => c.PropertyValue).Return(_propertyValue); }
public void SetUp() { _registry = StructureMapContainerFacility.GetBasicFubuContainer().GetInstance <IValueConverterRegistry>().As <ValueConverterRegistry>(); _property = typeof(HttpRequestBase).GetProperty("Browser"); _aspNetObjectConversionFamily = _registry.Families.SingleOrDefault(cf => cf.Matches(_property)) as AspNetObjectConversionFamily; _aspNetObjectConversionFamily.ShouldNotBeNull(); _context = MockRepository.GenerateMock <IPropertyContext>(); _propertyValue = new object(); _context.Expect(c => c.PropertyValue).Return(_propertyValue); }
public void SetUp() { context = new InMemoryBindingContext(); theConverterRegistry = new ValueConverterRegistry(new IConverterFamily[0], new ConverterLibrary()); propertyBinder = new ConversionPropertyBinder(theConverterRegistry); }
public void SetUp() { _registry = new ValueConverterRegistry(new IConverterFamily[0], new ConverterLibrary()); _property = typeof (PropertyHolder).GetProperty("Property"); _numericTypeFamily = _registry.Families.FirstOrDefault(cf => cf.Matches(_property)) as NumericTypeFamily; _numericTypeFamily.ShouldNotBeNull(); _context = MockRepository.GenerateMock<IPropertyContext>(); _context.Stub(x => x.Property).Return(_property); _propertyValue = "1,000.001"; _context.Expect(c => c.PropertyValue).Return(_propertyValue).Repeat.Times(4); }
public RecordingValueConverterRegistry(ValueConverterRegistry inner, Func<IDebugReport> report) { _inner = inner; _report = report; }
public void SetUp() { registry = new ValueConverterRegistry(new IConverterFamily[0]); data = new InMemoryRequestData(); binder = new StandardModelBinder(registry, new TypeDescriptorRegistry()); locator = MockRepository.GenerateMock<IServiceLocator>(); result = null; }
static PropertyValue() { ConverterRegistry = new ValueConverterRegistry <TPropertyType>(); }