public void convert_back_value_converts_to_target_type_if_possible()
 {
     var converter = new FormatConverter
     {
         FormatString = "{0:00.00}"
     };
     Assert.Equal(123, converter.ConvertBack("123", typeof(int), null, null));
     Assert.Equal(13.80, converter.ConvertBack("13.8", typeof(double), null, null));
 }
Exemplo n.º 2
0
        public void convert_back_value_uses_specified_culture()
        {
            var converter = new FormatConverter
            {
                FormatString = "{0:00.00}"
            };

            Assert.Equal(123, converter.ConvertBack("123", typeof(int), null, new CultureInfo("de-DE")));
            Assert.Equal(13.80, converter.ConvertBack("13,8", typeof(double), null, new CultureInfo("de-DE")));
        }
Exemplo n.º 3
0
        public void convert_back_value_converts_to_target_type_if_possible()
        {
            var converter = new FormatConverter
            {
                FormatString = "{0:00.00}"
            };

            Assert.Equal(123, converter.ConvertBack("123", typeof(int), null, null));
            Assert.Equal(13.80, converter.ConvertBack("13.8", typeof(double), null, null));
        }
 public void convert_back_value_returns_unset_value_if_the_conversion_fails()
 {
     var converter = new FormatConverter
     {
         FormatString = "{0:00.00}"
     };
     Assert.Same(DependencyProperty.UnsetValue, converter.ConvertBack("abc", typeof(int), null, null));
 }
Exemplo n.º 5
0
        public void convert_back_value_returns_unset_value_if_the_conversion_fails()
        {
            var converter = new FormatConverter
            {
                FormatString = "{0:00.00}"
            };

            Assert.Same(DependencyProperty.UnsetValue, converter.ConvertBack("abc", typeof(int), null, null));
        }
Exemplo n.º 6
0
        public void convert_back_value_throws_if_there_is_no_target_type()
        {
            var converter = new FormatConverter();

            Assert.Throws <ArgumentNullException>(() => converter.ConvertBack(null, (Type)null, null, null));
        }
Exemplo n.º 7
0
        public void convert_back_values_returns_null()
        {
            var converter = new FormatConverter();

            Assert.Null(converter.ConvertBack("something", new Type[] { }, null, null));
        }
 public void convert_back_value_uses_specified_culture()
 {
     var converter = new FormatConverter
     {
         FormatString = "{0:00.00}"
     };
     Assert.Equal(123, converter.ConvertBack("123", typeof(int), null, new CultureInfo("de-DE")));
     Assert.Equal(13.80, converter.ConvertBack("13,8", typeof(double), null, new CultureInfo("de-DE")));
 }
 public void convert_back_value_throws_if_there_is_no_target_type()
 {
     var converter = new FormatConverter();
     Assert.Throws<ArgumentNullException>(() => converter.ConvertBack(null, (Type)null, null, null));
 }
 public void convert_back_values_returns_null()
 {
     var converter = new FormatConverter();
     Assert.Null(converter.ConvertBack("something", new Type[] { }, null, null));
 }