void InterpretTable(Tree <Cell> table) { Cell heading = table.Branches[0].Branches[0].Value; if (heading == null || processor.TestStatus.IsAbandoned) { return; } if (flowFixture == null && tableCount == 1) { GetStartingFixture(table); } if (flowFixture == null) { if (activeFixture == null) { activeFixture = processor.ParseTree <Cell, Interpreter>(table.Branches[0]); } var activeFlowFixture = activeFixture as FlowInterpreter; if (activeFlowFixture != null && activeFlowFixture.IsInFlow(tableCount)) { flowFixture = activeFlowFixture; } if (!activeFixture.IsVisible) { tableCount--; } DoTable(table, activeFixture, flowFixture != null); } else { flowFixture.InterpretFlow(table); } }
TypedValue Return(FlowInterpreter interpreter, Tree <Cell> row) { var result = new MethodPhrase(row).Evaluate(interpreter, Processor); Processor.CallStack.SetReturn(new TypedValue(result)); return(TypedValue.Void); }
void ExecuteProcedure(FlowInterpreter flowInterpreter, Tree <Cell> body) { foreach (var table in body.Branches) { new InterpretFlow().DoTableFlow(Processor, flowInterpreter, table); } }
TypedValue Show(FlowInterpreter interpreter, Tree <Cell> row) { try { AddCell(row, interpreter.ExecuteFlowRowMethod(Processor, row)); } catch (IgnoredException) {} return(TypedValue.Void); }
TypedValue Start(FlowInterpreter interpreter, Tree <Cell> row) { try { interpreter.SetSystemUnderTest(new MethodPhrase(row).EvaluateNew(Processor)); } catch (System.Exception e) { Processor.TestStatus.MarkException(row.Branches[0].Value, e); } return(TypedValue.Void); }
public static object ExecuteFlowRowMethod(this FlowInterpreter interpreter, CellProcessor processor, Tree <Cell> row) { try { var cells = row.Skip(1); return(cells.ExecuteMethod(processor, interpreter).ThrowExceptionIfNotValid().Value); } catch (ParseException <Cell> e) { processor.TestStatus.MarkException(e.Subject, e.InnerException); throw new IgnoredException(); } }
void GetStartingFixture(Tree<Cell> table) { try { activeFixture = processor.ParseTree<Cell, Interpreter>(table.Branches[0]); flowFixture = null; } catch (TypeMissingException) { flowFixture = MakeDefaultFlowInterpreter(processor, TypedValue.Void); activeFixture = flowFixture; } }
void GetStartingFixture(Tree<Cell> table) { try { activeFixture = processor.ParseTree<Cell, Interpreter>(table.Branches[0]); flowFixture = null; } catch (TypeMissingException) { activeFixture = processor.ParseTree<Cell, Interpreter>(new CellTree("fitlibrary.DoFixture")); flowFixture = (FlowInterpreter) activeFixture; } }
private FlowInterpreter InterpretTable(FlowInterpreter flowInterpreter, Tree <Cell> table) { if (flowInterpreter == null) { var interpreter = Processor.ParseTree <Cell, Interpreter>(table.Branches[0]); interpreter.Interpret(table); return(interpreter as FlowInterpreter); } flowInterpreter.InterpretFlow(table); return(flowInterpreter); }
TypedValue ShowAs(FlowInterpreter interpreter, Tree <Cell> row) { try { var restOfRow = row.Skip(1); var attributes = GetAttributes(Processor.Parse <Cell, string>(row.Branches[1].Value)); var value = interpreter.ExecuteFlowRowMethod(Processor, restOfRow); AddCell(row, new ComposeShowAsOperator(attributes, value)); } catch (IgnoredException) {} return(TypedValue.Void); }
void GetStartingFixture(Tree <Cell> table) { try { activeFixture = processor.ParseTree <Cell, Interpreter>(table.Branches[0]); flowFixture = null; } catch (TypeMissingException) { activeFixture = processor.ParseTree <Cell, Interpreter>(new CellTree("fitlibrary.DoFixture")); flowFixture = (FlowInterpreter)activeFixture; } }
TypedValue Not(FlowInterpreter interpreter, Tree <Cell> row) { var firstCell = row.Branches[0].Value; try { Processor.TestStatus.ColorCell(firstCell, !(bool)interpreter.ExecuteFlowRowMethod(Processor, row)); } catch (IgnoredException) {} catch (System.Exception) { Processor.TestStatus.MarkRight(firstCell); } return(TypedValue.Void); }
public void DoTableFlow(CellProcessor processor, FlowInterpreter interpreter, Tree<Cell> table) { this.interpreter = interpreter; this.processor = processor; if (processor.TestStatus.IsAbandoned) return; hasFinishedTable = false; for (var i = 0; i < table.Branches.Count; i++) { if (i < rowsToSkip) continue; if (hasFinishedTable) break; ProcessFlowRow(table, i); } }
TypedValue Name(FlowInterpreter interpreter, Tree <Cell> row) { if (row.Branches.Count < 3) { throw new TableStructureException("missing cells for name."); } var namedValue = withIdentifier.Equals(row.Branches[2].Value.Text) ? new MethodPhrase(row.Skip(2)).Evaluate(interpreter, Processor) : interpreter.ExecuteFlowRowMethod(Processor, row.Skip(1)); Processor.Get <Symbols>().Save(row.Branches[1].Value.Text, namedValue); Processor.TestStatus.MarkRight(row.Branches[1].Value); return(TypedValue.Void); }
public static TypedValue InvokeSpecialAction(this Tree<Cell> row, CellProcessor processor, FlowInterpreter interpreter) { var specialActionName = processor.ParseTree<Cell, MemberName>(row.Branches[0]); try { var result = processor.Operate<InvokeSpecialOperator>(new TypedValue(interpreter), specialActionName, row); if (result.IsValid) { SetSyntaxKeyword(row); } return result; } catch (System.Exception) { SetSyntaxKeyword(row); throw; } }
public void Evaluate(CellProcessor processor, FlowInterpreter interpreter) { var specialActionName = processor.ParseTree<Cell, MemberName>(row.Branches[0]); var result = processor.Operate<InvokeSpecialOperator>(new TypedValue(interpreter), specialActionName, row.Branches[0]); if (result.IsValid) { row.ValueAt(0).SetAttribute(CellAttribute.Syntax, CellAttributeValue.SyntaxKeyword); return; } if (!result.IsValid) { processor.Execute(interpreter, interpreter.MethodRowSelector.SelectMethodCells(row), interpreter.MethodRowSelector.SelectParameterCells(row), row.ValueAt(0)); } }
public static object ExecuteFlowRowMethod(this FlowInterpreter interpreter, CellProcessor processor, Tree <Cell> row) { try { var cells = row.Skip(1); return (processor.ExecuteWithThrow(interpreter, interpreter.MethodRowSelector.SelectMethodCells(cells), interpreter.MethodRowSelector.SelectParameterCells(cells), row.ValueAt(1)). Value); } catch (ParseException <Cell> e) { processor.TestStatus.MarkException(e.Subject, e.InnerException); throw new IgnoredException(); } }
public void Evaluate(CellProcessor processor, FlowInterpreter interpreter) { var specialActionName = processor.ParseTree <Cell, MemberName>(row.Branches[0]); var result = processor.Operate <InvokeSpecialOperator>(new TypedValue(interpreter), specialActionName, row.Branches[0]); if (result.IsValid) { row.ValueAt(0).SetAttribute(CellAttribute.Syntax, CellAttributeValue.SyntaxKeyword); return; } if (!result.IsValid) { processor.Execute(interpreter, interpreter.MethodRowSelector.SelectMethodCells(row), interpreter.MethodRowSelector.SelectParameterCells(row), row.ValueAt(0)); } }
void DoCheckOperation(FlowInterpreter interpreter, Tree <Cell> row, bool isVolatile) { try { var methodCells = GetMethodCellRange(row, 1); try { Processor.Operate <CheckOperator>( CellOperationValue.Make( interpreter, interpreter.MethodRowSelector.SelectMethodCells(methodCells), interpreter.MethodRowSelector.SelectParameterCells(methodCells), isVolatile), row.Last()); } catch (MemberMissingException e) { Processor.TestStatus.MarkException(row.Branches[1].Value, e); } catch (System.Exception e) { Processor.TestStatus.MarkException(row.Last().Value, e); } } catch (IgnoredException) {} }
public void DoTableFlow(CellProcessor processor, FlowInterpreter interpreter, Tree <Cell> table) { this.interpreter = interpreter; this.processor = processor; if (processor.TestStatus.IsAbandoned) { return; } hasFinishedTable = false; for (var i = 0; i < table.Branches.Count; i++) { if (i < rowsToSkip) { continue; } if (hasFinishedTable) { break; } ProcessFlowRow(table, i); } }
TypedValue Note(FlowInterpreter interpreter, Tree<Cell> row) { return TypedValue.Void; }
TypedValue Name(FlowInterpreter interpreter, Tree<Cell> row) { if (row.Branches.Count < 3) { throw new TableStructureException("missing cells for name."); } var namedValue = withIdentifier.Equals(row.Branches[2].Value.Text) ? new MethodPhrase(row.Skip(2)).Evaluate(interpreter, Processor) : interpreter.ExecuteFlowRowMethod(Processor, row.Skip(1)); Processor.Get<Symbols>().Save(row.Branches[1].Value.Text, namedValue); Processor.TestStatus.MarkRight(row.Branches[1].Value); return TypedValue.Void; }
TypedValue Comment(FlowInterpreter interpreter, Tree<Cell> row) { return new TypedValue(new CommentFixture()); }
TypedValue Calculate(FlowInterpreter fixture, Parse theCells) { return(new TypedValue(new CalculateFixture(fixture.SystemUnderTest ?? fixture))); }
bool IsNewFlowFixture(Interpreter fixture, int row) { var newFlowFixture = fixture as FlowInterpreter; if (row == 0 && newFlowFixture != null && newFlowFixture.IsInFlow(processor.TestStatus.TableCount)) { flowFixture = newFlowFixture; return true; } return false; }
TypedValue WaitUntil(FlowInterpreter interpreter, Tree<Cell> row) { DoCheckOperation(interpreter, row, true); return TypedValue.Void; }
TypedValue CheckFieldsFor(FlowInterpreter interpreter, Tree <Cell> row) { return(new TypedValue(new List <object> { interpreter.ExecuteFlowRowMethod(Processor, row) })); }
TypedValue Check(FlowInterpreter interpreter, Tree <Cell> row) { DoCheckOperation(interpreter, row, false); return(TypedValue.Void); }
TypedValue With(FlowInterpreter interpreter, Tree <Cell> row) { interpreter.SetSystemUnderTest(new MethodPhrase(row).Evaluate(interpreter, Processor)); return(TypedValue.Void); }
TypedValue WaitUntil(FlowInterpreter interpreter, Tree <Cell> row) { DoCheckOperation(interpreter, row, true); return(TypedValue.Void); }
TypedValue Set(FlowInterpreter interpreter, Tree<Cell> row) { interpreter.ExecuteFlowRowMethod(Processor, row); return TypedValue.Void; }
TypedValue ShowAs(FlowInterpreter interpreter, Tree<Cell> row) { try { var restOfRow = row.Skip(1); var attributes = GetAttributes(Processor.Parse<Cell, string>(row.Branches[1].Value)); var value = interpreter.ExecuteFlowRowMethod(Processor, restOfRow); AddCell(row, new ComposeShowAsOperator(attributes, value)); } catch (IgnoredException) {} return TypedValue.Void; }
TypedValue Comment(FlowInterpreter interpreter, Tree <Cell> row) { return(new TypedValue(new CommentFixture())); }
TypedValue Set(FlowInterpreter interpreter, Tree <Cell> row) { interpreter.ExecuteFlowRowMethod(Processor, row); return(TypedValue.Void); }
public static TypedValue InvokeSpecialAction(this Tree <Cell> row, CellProcessor processor, FlowInterpreter interpreter) { var specialActionName = processor.ParseTree <Cell, MemberName>(row.Branches[0]); try { var result = processor.Operate <InvokeSpecialOperator>(new TypedValue(interpreter), specialActionName, row); if (result.IsValid) { SetSyntaxKeyword(row); } return(result); } catch (System.Exception) { SetSyntaxKeyword(row); throw; } }
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; }
TypedValue Note(FlowInterpreter interpreter, Tree <Cell> row) { return(TypedValue.Void); }
TypedValue Ignored(FlowInterpreter fixture, Parse cells) { return(new TypedValue(new Fixture())); }
public static TypedValue ExecuteMethod(this Tree<Cell> row, CellProcessor processor, FlowInterpreter interpreter) { return row.ExecuteMethod(processor, interpreter.MethodRowSelector, interpreter); }
public InterpretFlow(CellProcessor processor, FlowInterpreter interpreter) { this.interpreter = interpreter; this.processor = processor; }
void DoCheckOperation(FlowInterpreter interpreter, Tree<Cell> row, bool isVolatile) { try { var methodCells = GetMethodCellRange(row, 1); try { Processor.Operate<CheckOperator>( CellOperationValue.Make( interpreter, interpreter.MethodRowSelector.SelectMethodCells(methodCells), interpreter.MethodRowSelector.SelectParameterCells(methodCells), isVolatile), row.Last()); } catch (MemberMissingException e) { Processor.TestStatus.MarkException(row.Branches[1].Value, e); } catch (System.Exception e) { Processor.TestStatus.MarkException(row.Last().Value, e); } } catch (IgnoredException) {} }
TypedValue Check(FlowInterpreter interpreter, Tree<Cell> row) { DoCheckOperation(interpreter, row, false); return TypedValue.Void; }
TypedValue Not(FlowInterpreter interpreter, Tree<Cell> row) { var firstCell = row.Branches[0].Value; try { Processor.TestStatus.ColorCell(firstCell, !(bool) interpreter.ExecuteFlowRowMethod(Processor, row)); } catch (IgnoredException) {} catch (System.Exception) { Processor.TestStatus.MarkRight(firstCell); } return TypedValue.Void; }
TypedValue AbandonStoryTest(FlowInterpreter fixture, Parse theCells) { Processor.TestStatus.MarkIgnore(theCells); Processor.TestStatus.IsAbandoned = true; throw new AbandonStoryTestException(); }
TypedValue Return(FlowInterpreter interpreter, Tree<Cell> row) { var result = new MethodPhrase(row).Evaluate(interpreter, Processor); Processor.CallStack.SetReturn(new TypedValue(result)); return TypedValue.Void; }
public FlowKeywords(FlowInterpreter fixture, CellProcessor processor) { this.fixture = fixture; this.processor = processor; }
TypedValue Show(FlowInterpreter interpreter, Tree<Cell> row) { try { AddCell(row, interpreter.ExecuteFlowRowMethod(Processor, row)); } catch (IgnoredException) {} return TypedValue.Void; }
TypedValue Start(FlowInterpreter interpreter, Tree<Cell> row) { try { interpreter.SetSystemUnderTest(new MethodPhrase(row).EvaluateNew(Processor)); } catch (System.Exception e) { Processor.TestStatus.MarkException(row.Branches[0].Value, e); } return TypedValue.Void; }
void InterpretTable(Tree<Cell> table) { Cell heading = table.Branches[0].Branches[0].Value; if (heading == null || processor.TestStatus.IsAbandoned) return; if (flowFixture == null && tableCount == 1) GetStartingFixture(table); if (flowFixture == null) { if (activeFixture == null) activeFixture = processor.ParseTree<Cell, Interpreter>(table.Branches[0]); var activeFlowFixture = activeFixture as FlowInterpreter; if (activeFlowFixture != null && activeFlowFixture.IsInFlow(tableCount)) flowFixture = activeFlowFixture; if (!activeFixture.IsVisible) tableCount--; DoTable(table, activeFixture, flowFixture != null); } else { flowFixture.InterpretFlow(table); } }
TypedValue With(FlowInterpreter interpreter, Tree<Cell> row) { interpreter.SetSystemUnderTest(new MethodPhrase(row).Evaluate(interpreter, Processor)); return TypedValue.Void; }
public static TypedValue InvokeSpecialAction(this Tree <Cell> row, CellProcessor processor, FlowInterpreter interpreter) { var specialActionName = processor.ParseTree <Cell, MemberName>(row.Branches[0]); var result = processor.Operate <InvokeSpecialOperator>(new TypedValue(interpreter), specialActionName, row.Branches[0]); return(result); }
TypedValue CheckFieldsFor(FlowInterpreter interpreter, Tree<Cell> row) { return new TypedValue(new List<object> { interpreter.ExecuteFlowRowMethod(Processor, row) }); }
public static TypedValue ExecuteMethod(this Tree <Cell> row, CellProcessor processor, FlowInterpreter interpreter) { return(row.ExecuteMethod(processor, interpreter.MethodRowSelector, interpreter)); }