public void Find_should_return_null_for_non_registered_type() { var customConverters = new CustomConverters(); var conversion = customConverters.Find(new ConversionKey(typeof(string), typeof(Foo))); Assert.IsNull(conversion); }
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 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 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 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 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 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); }