Exemplo n.º 1
0
 //
 //
 //    // Factory //////////////////////////////////
 //
 public static TypeAdapter on(Fixture target, Type type)
 {
     TypeAdapter adapter = new TypeAdapter();
     adapter.fixture = target;
     adapter.target = target;
     adapter.type = type;
     return adapter;
 }
Exemplo n.º 2
0
 public override void check(Parse cell, TypeAdapter a)
 {
     if (!hasExecuted) {
         try {
             execute();
         }
         catch (Exception e) {
             exception (cell, e);
         }
         hasExecuted = true;
     }
     base.check(cell, a);
 }
Exemplo n.º 3
0
 public virtual void check(Parse cell, TypeAdapter a)
 {
     string text = cell.text();
     if (text == "") {
         try {
             info(cell, a.ToString(a.get()));
         }
         catch (Exception) {
             info(cell, "error");
         }
     }
     else if (a == null) {
         ignore(cell);
     }
     else if (text == "error") {
         try {
             wrong(cell, a.ToString(a.get()));
         }
         catch (MethodAccessException e) {
             exception (cell, e);
         }
         catch (Exception) {
             right(cell);
         }
     }
     else {
         try {
             object result = a.get();
             if (a.equals(a.parse(text), result)) {
                 right(cell);
             }
             else {
                 wrong(cell, a.ToString(a.get()));
             }
         }
         catch (Exception e) {
             exception(cell, e);
         }
     }
 }