Example #1
0
        public static TypedValue Invoke(this CellOperation operation, object target, Tree <Cell> memberName, Tree <Cell> parameters, Tree <Cell> targetCell)
        {
            TypedValue result = operation.TryInvoke(target, memberName, parameters, targetCell);

            result.ThrowExceptionIfNotValid();
            return(result);
        }
Example #2
0
 protected void ProcessFlowRow(Parse theCurrentRow)
 {
     try {
         string specialActionName = RuntimeDirect.MakeDirect(
             Processor.ParseTree <Cell, MemberName>(new CellRange(theCurrentRow.Parts, 1)).ToString());
         TypedValue result = Processor.Invoke(new FlowKeywords(this), specialActionName, theCurrentRow.Parts);
         if (!result.IsValid)
         {
             result = Processor.Invoke(this, specialActionName, theCurrentRow.Parts);
         }
         if (!result.IsValid)
         {
             result = CellOperation.TryInvoke(this,
                                              new CellRange(MethodCells(new CellRange(theCurrentRow.Parts))),
                                              new CellRange(ParameterCells(new CellRange(theCurrentRow.Parts))),
                                              theCurrentRow.Parts);
         }
         if (!result.IsValid)
         {
             if (theCurrentRow.Parts.Text.Length > 0)
             {
                 var newFixture = Processor.ParseTree <Cell, Interpreter>(theCurrentRow);
                 var adapter    = newFixture as MutableDomainAdapter;
                 if (adapter != null)
                 {
                     adapter.SetSystemUnderTest(SystemUnderTest);
                 }
                 ProcessRestOfTable(newFixture, theCurrentRow);
                 IHaveFinishedTable = true;
             }
             else
             {
                 result.ThrowExceptionIfNotValid();
             }
         }
         else
         {
             if (TestStatus.IsAbandoned)
             {
                 TestStatus.MarkIgnore(theCurrentRow);
                 return;
             }
             object wrapResult = FixtureResult.Wrap(result.Value);
             if (wrapResult is bool)
             {
                 ColorMethodName(theCurrentRow.Parts, (bool)wrapResult);
             }
             else if (wrapResult is Fixture)
             {
                 ProcessRestOfTable((Fixture)wrapResult, theCurrentRow);
                 IHaveFinishedTable = true;
                 return;
             }
         }
     }
     catch (IgnoredException) {}
     catch (ParseException <Cell> e) {
         TestStatus.MarkException(e.Subject, e);
         IHaveFinishedTable = true;
     }
     catch (Exception e) {
         TestStatus.MarkException(theCurrentRow.Parts, e);
         IHaveFinishedTable = true;
     }
 }
Example #3
0
 public static TypedValue TryInvoke(this CellOperation operation, object target, Tree <Cell> memberName, Tree <Cell> parameters)
 {
     return(operation.TryInvoke(target, memberName, parameters, null));
 }
Example #4
0
 public static TypedValue TryInvoke(this CellOperation operation, object target, Tree <Cell> memberName)
 {
     return(operation.TryInvoke(target, memberName, new CellTree()));
 }
Example #5
0
 public static TypedValue TryInvoke(this CellOperation operation, object target, Tree <Cell> memberName, Tree <Cell> parameters)
 {
     return(operation.TryInvoke(target, memberName, parameters, new CellBase(string.Empty)));
 }