public void Custom_conversion()
 {
     var extensionPoints = new DefaultExtensionPoints();
     extensionPoints.CustomConverters.Register<string, Foo>(x => new Foo(Int32.Parse(x)));
     var converter = new RuleBasedConverter(extensionPoints, EmptyArray<IConversionRule>.Instance);
     var actual = (Foo)converter.Convert("123", typeof(Foo));
     Assert.AreEqual(123, actual.Value);
 }
 public void Custom_formatting()
 {
     var extentionPoints = new DefaultExtensionPoints();
     var formatter = new RuleBasedFormatter(extentionPoints, EmptyArray<IFormattingRule>.Instance);
     extentionPoints.CustomFormatters.Register<Foo>(x => String.Format("Foo's value is {0}.", x.Value));
     string output = formatter.Format(new Foo(123));
     Assert.AreEqual("Foo's value is 123.", output);
 }