public void DontSupplyAnyCustomConverters() { CustomConverterConfigurer config = new CustomConverterConfigurer(); config.CustomConverters = null; config.PostProcessObjectFactory(factory); mocks.ReplayAll(); mocks.VerifyAll(); }
public void UseInvalidKeyForConverterMapKey() { IDictionary converters = new Hashtable(); converters.Add(12, typeof(DateTimeConverter)); CustomConverterConfigurer config = new CustomConverterConfigurer(); config.CustomConverters = converters; Assert.Throws <ObjectInitializationException>(() => config.PostProcessObjectFactory(factory)); }
public void UseNonTypeConverterForConverterMapValue() { IDictionary converters = new Hashtable(); converters.Add(typeof(DateTime), null); CustomConverterConfigurer config = new CustomConverterConfigurer(); config.CustomConverters = converters; Assert.Throws <ObjectInitializationException>(() => config.PostProcessObjectFactory(factory)); }
public void UseNonResolvableTypeForConverterMapKey() { IDictionary converters = new Hashtable(); // purposely misspelled... :D converters.Add("Systemm.Date", typeof(DateTimeConverter)); CustomConverterConfigurer config = new CustomConverterConfigurer(); config.CustomConverters = converters; Assert.Throws <ObjectInitializationException>(() => config.PostProcessObjectFactory(factory)); }
public void SunnyDayScenario() { IDictionary converters = new Hashtable(); Type dateTimeType = typeof(DateTime); DateTimeConverter dateTimeConverter = new DateTimeConverter(); Type colorType = typeof(Color); ColorConverter colorConverter = new ColorConverter(); converters.Add(dateTimeType, dateTimeConverter); converters.Add(colorType, colorConverter); factory.RegisterCustomConverter(dateTimeType, dateTimeConverter); factory.RegisterCustomConverter(colorType, colorConverter); mocks.ReplayAll(); CustomConverterConfigurer config = new CustomConverterConfigurer(); config.CustomConverters = converters; config.PostProcessObjectFactory(factory); mocks.VerifyAll(); }