public static void FromIFormattable() { FooFormattable foo = new FooFormattable(3); string result = Convert.ToString(foo); Assert.Equal("FooFormattable: 3", result); result = Convert.ToString(foo, NumberFormatInfo.CurrentInfo); Assert.Equal("System.Globalization.NumberFormatInfo: 3", result); foo = null; result = Convert.ToString(foo, NumberFormatInfo.CurrentInfo); Assert.Equal("", result); }
public static void FromIFormattable() { FooFormattable foo = new FooFormattable(3); string result = Convert.ToString(foo); Assert.AreEqual("FooFormattable: 3", result); result = Convert.ToString(foo, NumberFormatInfo.CurrentInfo); Assert.AreEqual("Bridge.NumberFormatInfo: 3", result); foo = null; result = Convert.ToString(foo, NumberFormatInfo.CurrentInfo); Assert.AreEqual("", result); }