Example #1
0
        public TypedValue Invoke(TypedValue instance, string memberName, Tree <U> parameters)
        {
            TypedValue result = TryInvoke(instance, memberName, parameters);

            result.ThrowExceptionIfNotValid();
            return(result);
        }
Example #2
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 #3
0
        public static TypedValue InvokeWithThrow <T>(this Processor <T> processor, TypedValue instance, MemberName memberName,
                                                     Tree <T> parameters)
        {
            TypedValue result = processor.Invoke(instance, memberName, parameters);

            result.ThrowExceptionIfNotValid();
            return(result);
        }
Example #4
0
        protected static TypedValue InvokeMember(Processor <string> processor, Tree <string> parameters, int memberIndex)
        {
            object     target = processor.Load(new SavedInstance(parameters.Branches[memberIndex].Value)).Instance;
            TypedValue result = processor.TryInvoke(new TypedValue(target), parameters.Branches[memberIndex + 1].Value, ParameterTree(parameters, memberIndex + 2));

            result.ThrowExceptionIfNotValid();
            return(result);
        }
        protected TypedValue InvokeMember(Tree <string> parameters, int memberIndex)
        {
            var        instance = new SavedInstance(parameters.Branches[memberIndex].Value);
            object     target   = Processor.Contains(instance) ? Processor.Load(instance).Instance : new NullInstance();
            TypedValue result   = Processor.Invoke(target, parameters.Branches[memberIndex + 1].Value, ParameterTree(parameters, memberIndex + 2));

            result.ThrowExceptionIfNotValid();
            return(result);
        }
Example #6
0
        protected TypedValue InvokeMember(Tree <string> parameters, int memberIndex)
        {
            var        savedInstances = Processor.Get <SavedInstances>();
            var        instance       = parameters.ValueAt(memberIndex);
            object     target         = savedInstances.HasValue(instance) ? savedInstances.GetValue(instance) : new NullInstance();
            TypedValue result         = Processor.Invoke(target, new MemberName(parameters.ValueAt(memberIndex + 1)), ParameterTree(parameters, memberIndex + 2));

            result.ThrowExceptionIfNotValid();
            return(result);
        }
Example #7
0
        public bool Compare(TypedValue actualValue, Tree <Cell> expected)
        {
            if (actualValue.IsVoid)
            {
                return(false);
            }
            actualValue.ThrowExceptionIfNotValid();
            var expectedValue = Processor.ParseTree(actualValue.Type, expected);

            return(AreEqual(actualValue, expectedValue, expected.Value));
        }
Example #8
0
        public void Interpret(Tree <Cell> table)
        {
            TypedValue result = Processor.Invoke(
                new TypedValue(Processor.Configuration.GetItem(table.Branches[0].Branches[1].Value.Text)),
                table.Branches[0].Branches[2].Value.Text,
                new CellTree());

            result.ThrowExceptionIfNotValid();
            if (result.IsVoid)
            {
                return;
            }
            table.Branches[0].Branches[2].Value.SetAttribute(CellAttribute.Extension, result.ValueString);
        }
Example #9
0
        public void Interpret(CellProcessor processor, Tree <Cell> table)
        {
            processor.TestStatus.TableCount--;
            TypedValue result = processor.Invoke(
                new TypedValue(processor.Configuration.GetItem(table.Branches[0].Branches[1].Value.Text)),
                table.Branches[0].Branches[2].Value.Text,
                new CellTree());

            result.ThrowExceptionIfNotValid();
            if (result.IsVoid)
            {
                return;
            }
            table.Branches[0].Branches[2].Value.SetAttribute(CellAttribute.Folded, result.ValueString);
        }
Example #10
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;
     }
 }