public void IsRegisteredFor_should_return_true_for_registered_type() { var customConverters = new CustomConverters(); customConverters.Register <string, Foo>(x => new Foo(Int32.Parse(x))); Conversion conversion = customConverters.Find(new ConversionKey(typeof(string), typeof(Foo))); Assert.IsNotNull(conversion); }
public void Converts() { var customConverters = new CustomConverters(); customConverters.Register <string, Foo>(x => new Foo(Int32.Parse(x))); Conversion conversion = customConverters.Find(new ConversionKey(typeof(string), typeof(Foo))); var actualFoo = (Foo)conversion("123"); Assert.AreEqual(123, actualFoo.Value); }
public void Register_and_unregister_ok() { var customConverters = new CustomConverters(); customConverters.Register <string, Foo>(x => new Foo(Int32.Parse(x))); customConverters.Unregister <string, Foo>(); var comversion = customConverters.Find(new ConversionKey(typeof(string), typeof(Foo))); Assert.IsNull(comversion); }
public void Generic_Registers_with_null_converter_should_throw_exception() { var customConverters = new CustomConverters(); customConverters.Register <string, Foo>(null); }
public void Registers_with_null_conversion_should_throw_exception() { var customConverters = new CustomConverters(); customConverters.Register(typeof(string), typeof(Foo), null); }
public void Registers_with_null_target_type_should_throw_exception() { var customConverters = new CustomConverters(); customConverters.Register(typeof(string), null, x => null); }
public void Registers_with_null_source_type_should_throw_exception() { var customConverters = new CustomConverters(); customConverters.Register(null, typeof(Foo), x => null); }
public void IsRegisteredFor_should_return_true_for_registered_type() { var customConverters = new CustomConverters(); customConverters.Register<string, Foo>(x => new Foo(Int32.Parse(x))); Conversion conversion = customConverters.Find(new ConversionKey(typeof(string), typeof(Foo))); Assert.IsNotNull(conversion); }
public void Converts() { var customConverters = new CustomConverters(); customConverters.Register<string, Foo>(x => new Foo(Int32.Parse(x))); Conversion conversion = customConverters.Find(new ConversionKey(typeof(string), typeof(Foo))); var actualFoo = (Foo)conversion("123"); Assert.AreEqual(123, actualFoo.Value); }
public void Generic_Registers_with_null_converter_should_throw_exception() { var customConverters = new CustomConverters(); customConverters.Register<string, Foo>(null); }
public void Registers_with_null_conversion_should_throw_exception() { var customConverters = new CustomConverters(); customConverters.Register(typeof(string), typeof(Foo), null); }
public void Registers_with_null_target_type_should_throw_exception() { var customConverters = new CustomConverters(); customConverters.Register(typeof(string), null, x => null); }
public void Registers_with_null_source_type_should_throw_exception() { var customConverters = new CustomConverters(); customConverters.Register(null, typeof(Foo), x => null); }
public void Register_and_unregister_ok() { var customConverters = new CustomConverters(); customConverters.Register<string, Foo>(x => new Foo(Int32.Parse(x))); customConverters.Unregister<string, Foo>(); var comversion = customConverters.Find(new ConversionKey(typeof(string), typeof(Foo))); Assert.IsNull(comversion); }