示例#1
0
        public void Convert_Date_Formatting()
        {
            var converter = new FormattingConverter();

#if NETFX_CORE
            var value = converter.Convert(new DateTime(2010, 12, 15), typeof(string), "d", "nl-NL");
#else
            var value = converter.Convert(new DateTime(2010, 12, 15), typeof(string), "d", new CultureInfo("nl-NL"));
#endif

            var firstExpectedValue  = "15-12-2010";
            var secondExpectedValue = "15-12-2010";

            if (!string.Equals(value, firstExpectedValue) && !string.Equals(value, secondExpectedValue))
            {
                Assert.Fail("None of the expected values were returned");
            }
        }
示例#2
0
        public void ConvertBack()
        {
            var converter = new FormattingConverter();

            Assert.AreEqual(ConverterHelper.UnsetValue, converter.ConvertBack(null, typeof(object), null, (CultureInfo)null));
        }
示例#3
0
        public void Convert_Integer_Formatting()
        {
            var converter = new FormattingConverter();

            Assert.AreEqual("5", converter.Convert(5, typeof(string), "d", (CultureInfo)null));
        }
示例#4
0
        public void Convert_Null_Formatting()
        {
            var converter = new FormattingConverter();

            Assert.AreEqual(string.Empty, converter.Convert(null, typeof(string), "d", (CultureInfo)null));
        }