Example #1
0
        public void Converter_StringFormatTests()
        {
            StringFormat conv = new StringFormat();
            string       val  = "1";
            string       fmt  = "test {0} value";

            conv.Format = fmt;


            Assert.AreEqual(String.Format(fmt, val), conv.Convert(val, typeof(string), null, CultureInfo.CurrentCulture),
                            "StringFormat Convert did not return the appropriate formated string");
            Assert.AreEqual(String.Format(fmt, String.Empty), conv.Convert(String.Empty, typeof(string), null, CultureInfo.CurrentCulture),
                            "StringFormat Convert did not return the appropriate formated string");
            try
            {
                conv.ConvertBack(val, typeof(string), null, CultureInfo.CurrentCulture);
                Assert.Fail("StringFormat ConvertBack did not throw a NotImplemented exception");
            }
            catch (NotImplementedException) { }
        }