Ejemplo n.º 1
0
 /// <inheritdoc/>
 public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
 {
     if (objectType == typeof(ShapeState))
     {
         return(ShapeState.Parse((string)reader.Value));
     }
     throw new ArgumentException("objectType");
 }
Ejemplo n.º 2
0
        public void Parse_ShapeStateFlags_String()
        {
            var target = ShapeState.Parse("Visible, Printable, Standalone");

            Assert.Equal(
                ShapeStateFlags.Visible
                | ShapeStateFlags.Printable
                | ShapeStateFlags.Standalone, target.Flags);
        }
Ejemplo n.º 3
0
 /// <inheritdoc/>
 public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value)
 {
     return(ShapeState.Parse((string)value));
 }