public void Parse_Should_Throw_Mixed_Values()
 {
     Assert.Throws <FormatException>(() =>
                                     RelativeRect.Parse("10%, 20%, 40, 70%"));
 }
        public void Parse_Should_Accept_Relative_Value()
        {
            var result = RelativeRect.Parse("10%, 20%, 40%, 70%");

            Assert.Equal(new RelativeRect(0.1, 0.2, 0.4, 0.7, RelativeUnit.Relative), result, Compare);
        }
        public void Parse_Should_Accept_Absolute_Value()
        {
            var result = RelativeRect.Parse("4,5,50,60");

            Assert.Equal(new RelativeRect(4, 5, 50, 60, RelativeUnit.Absolute), result, Compare);
        }
예제 #4
0
 public object ConvertFrom(IXamlTypeConverterContext context, CultureInfo culture, object value)
 {
     return(RelativeRect.Parse((string)value, culture));
 }
예제 #5
0
 public void Parse_Should_Throw_Mixed_Values()
 {
     Assert.Throws <FormatException>(() =>
                                     RelativeRect.Parse("10%, 20%, 40, 70%", CultureInfo.InvariantCulture));
 }
 public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value)
 {
     return(RelativeRect.Parse((string)value, culture));
 }