TypedValue InterpretTables(Tree <Cell> theTables)
            {
                processor.TestStatus.TableCount = 1;
                flowFixture = new DefaultFlowInterpreter(null);
                foreach (var table in theTables.Branches)
                {
                    try {
                        try {
                            InterpretTable(table);
                        }
                        catch (System.Exception e) {
                            processor.TestStatus.MarkException(table.ValueAt(0, 0), e);
                        }
                    }
                    catch (System.Exception e) {
                        if (!(e is AbandonException))
                        {
                            throw;
                        }
                    }

                    writer.WriteTable(table);

                    processor.TestStatus.TableCount++;
                }
                flowFixture.DoTearDown(theTables.Branches[0]);
                return(TypedValue.Void);
            }
        public void ReturnsMethodValue()
        {
            var processor   = Builder.CellProcessor();
            var interpreter = new DefaultFlowInterpreter(new SampleClass());

            processor.CallStack.DomainAdapter = new TypedValue(interpreter);
            Assert.AreEqual("samplereturn", new ValuePhrase(new CellTree("keyword", "methodnoparms")).Evaluate(processor));
        }
예제 #3
0
        static void Evaluate(Tree <Cell> rowTree, object systemUnderTest)
        {
            var interpreter = new DefaultFlowInterpreter(systemUnderTest);
            var row         = new FlowRow(rowTree);
            var processor   = Builder.CellProcessor();

            processor.AddOperator(new TestInvokeSpecialAction(), 2);
            row.Evaluate(processor, interpreter);
        }
        private TypedValue Invoke(Parse procedure, TypedValue target, Tree <Cell> parameterValues)
        {
            var fixture = new DefaultFlowInterpreter(target.Value);

            var parameters = new Parameters(procedure.Parts, parameterValues);
            var body       = procedure.Parts.More.Parts.Parts != null
                ? new CellTree(procedure.Parts.More.Parts.Parts.DeepCopy(parameters.Substitute, s => s.More, s => s.Parts).SiblingTrees)
                : new CellTree((Tree <Cell>)procedure.DeepCopy(
                                   parameters.Substitute,
                                   s => s == procedure ? null : s.More,
                                   s => s == procedure ? s.Parts.More : s.Parts));

            body.ValueAt(0).ClearAttribute(CellAttribute.Leader);

            Processor.CallStack.Push();
            ExecuteProcedure(fixture, body);
            Processor.TestStatus.LastAction = Processor.ParseTree(typeof(StoryTestString), body).ValueString;
            return(Processor.CallStack.PopReturn());
        }
예제 #5
0
        private TypedValue Invoke(Tree <Cell> procedure, TypedValue target, Tree <Cell> parameterValues)
        {
            var copy       = new DeepCopy(Processor);
            var parameters = new Parameters(procedure.Branches[0], parameterValues, copy);
            var body       = procedure.Branches[1].Branches[0].IsLeaf
                ? new CellTree(copy.Make(procedure,
                                         source => source.Branches.Skip(1),
                                         parameters.Substitute))
                : new CellTree(
                procedure.Branches[1].Branches[0].Branches.Select(branch => copy.Make(branch, parameters.Substitute)));

            body.ValueAt(0).ClearAttribute(CellAttribute.Leader);

            Processor.CallStack.Push();
            var fixture = new DefaultFlowInterpreter(target.Value);

            ExecuteProcedure(fixture, body);
            Processor.TestStatus.LastAction = body.WriteBranches();
            return(Processor.CallStack.PopReturn());
        }