Ejemplo n.º 1
0
 public static string ToString(StepValue value)
 {
     if (value.Kind == StepValueKind.String)
     {
         return(((StringValue)value).Value);
     }
     else if (value.Kind == StepValueKind.Missing)
     {
         return(null);
     }
     else
     {
         //TODO: error
         throw new NotSupportedException();
     }
 }
Ejemplo n.º 2
0
 private static List <T> ConvertToList <T>(StepValue value, Func <StepValue, object> elementMapper)
 {
     if (value.Kind == StepValueKind.List)
     {
         var list   = (ListValue)value;
         var result = new List <T>();
         foreach (var item in list.Items)
         {
             result.Add((T)elementMapper(item));
         }
         return(result);
     }
     else if (value.Kind == StepValueKind.Missing)
     {
         return(null);
     }
     else
     {
         throw new NotImplementedException();
     }
 }
Ejemplo n.º 3
0
 public static T ToObject <T>(StepValue value)
 {
     return((T)GetOrCreateConverter(typeof(T))(value));
 }
Ejemplo n.º 4
0
 public static List <T> ToList <T>(StepValue value)
 {
     return(ConvertToList <T>(value, GetOrCreateConverter(typeof(T))));
 }