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; } }
public void Interpret(CellProcessor processor, Tree <Cell> table) { processor.TestStatus.TableCount--; var name = processor.ParseTree <Cell, MemberName>(new EnumeratedTree <Cell>(table.Branches[0].Branches.Skip(1).Alternate())); processor.Get <Procedures>().Save(name.ToString(), table); }
public BindingOperation Make(Tree <Cell> nameCell) { var name = nameCell.Value.Text.Trim(); if (NoOperationIsImpliedBy(name)) { return(new NoBinding()); } if (CheckIsImpliedBy(name)) { return(new CheckBinding(processor, targetProvider, nameCell)); } var memberName = processor.ParseTree <Cell, MemberName>(nameCell); var member = MemberQuery.FindInstance(processor.FindMember, targetProvider, new MemberSpecification(memberName, 1)); if (member == null && newIdentifier.IsStartOf(name)) { string newMemberName = name.Substring(4); return(new CreateBinding(processor, adapter, newMemberName)); } return(new InputBinding(processor, targetProvider, nameCell)); }
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); }
public object Evaluate(DomainAdapter theFixture, CellProcessor processor) { cells.ValueAt(0).SetAttribute(CellAttribute.Syntax, CellAttributeValue.SyntaxKeyword); var cellCount = cells.Branches.Count; if (cellCount < 2) throw MakeException("missing cells"); var identifier = cells.ValueAt(1).Text; if (newIdentifier.Equals(identifier)) { cells.ValueAt(1).SetAttribute(CellAttribute.Syntax, CellAttributeValue.SyntaxKeyword); return new MethodPhrase(cells.Skip(1)).EvaluateNew(processor); } if (typeIdentifier.Equals(identifier)) { cells.ValueAt(1).SetAttribute(CellAttribute.Syntax, CellAttributeValue.SyntaxKeyword); if (cellCount < 3) throw MakeException("missing cells"); cells.ValueAt(2).SetAttribute(CellAttribute.Syntax, CellAttributeValue.SyntaxSUT); return processor.ParseTree(typeof (Type), cells.Branches[2]).Value; } if (currentIdentifier.Equals(identifier)) { cells.ValueAt(1).SetAttribute(CellAttribute.Syntax, CellAttributeValue.SyntaxKeyword); return theFixture.SystemUnderTest; } var fixture = theFixture as FlowInterpreter; if (fixture == null) throw MakeException("flow fixture required"); return processor.Get<Symbols>().HasValue(identifier) ? processor.Get<Symbols>().GetValue(identifier) : fixture.ExecuteFlowRowMethod(processor, cells); }
public BindingOperation Make(Tree <Cell> nameCell) { string name = nameCell.Value.Text.Trim(); if (NoOperationIsImpliedBy(name)) { return(new NoBinding()); } var cellOperation = new CellOperationImpl(processor); if (CheckIsImpliedBy(name)) { return(new CheckBinding(cellOperation, targetProvider, nameCell)); } string memberName = processor.ParseTree <Cell, MemberName>(nameCell).ToString(); RuntimeMember member = RuntimeType.FindInstance(targetProvider, new IdentifierName(memberName), 1); if (member == null && newIdentifier.IsStartOf(name)) { string newMemberName = name.Substring(4); return(new CreateBinding(processor, adapter, newMemberName)); } return(new InputBinding(processor, targetProvider, nameCell)); }
static Interpreter MakeNewFixture(CellProcessor processor, Tree<Cell> firstRow) { var fixture = processor.ParseTree<Cell, Interpreter>(firstRow.Skip(1)); if (firstRow.Branches.Count > 2) { var adapter = fixture as MutableDomainAdapter; if (adapter != null) { var parent = processor.CallStack.DomainAdapter.GetValueAs<DomainAdapter>(); adapter.SetSystemUnderTest(new MethodPhrase(firstRow.Skip(2)).Evaluate(parent, processor)); } } return fixture; }
void ComputeRow(CellProcessor processor, Tree<Cell> row) { var memberName = processor.ParseTree<Cell, MemberName>(headerRow.Branches.Last()).WithNamedParameters(); var parameterList = new List<Tree<Cell>>(); for (var i = 0; i < headerRow.Branches.Count - 1; i++) { parameterList.Add(new CellTreeLeaf(new GracefulName(headerRow.ValueAt(i).Text).ToString())); parameterList.Add(row.Branches[i]); } var result = processor.Invoke(processor.CallStack.DomainAdapter, memberName, new EnumeratedTree<Cell>(parameterList)); processor.Check(result, row.Branches.Last()); }
void ComputeRow(CellProcessor processor, Tree<Cell> row) { var memberName = MemberName.NamedParameterPrefix + processor.ParseTree<Cell, MemberName>(headerRow.Branches.Last()); var parameterList = new List<Tree<Cell>>(); for (var i = 0; i < headerRow.Branches.Count - 1; i++) { parameterList.Add(new CellTreeLeaf(new GracefulName(headerRow.Branches[i].Value.Text).ToString())); parameterList.Add(row.Branches[i]); } var result = processor.Invoke(new TypedValue(SystemUnderTest), memberName, new EnumeratedTree<Cell>(parameterList)); new CellOperationImpl(processor).Check(result, row.Branches.Last()); }
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; } }
static Interpreter MakeNewFixture(CellProcessor processor, Tree <Cell> firstRow) { var fixture = processor.ParseTree <Cell, Interpreter>(firstRow.Skip(1)); if (firstRow.Branches.Count > 2) { var adapter = fixture as MutableDomainAdapter; if (adapter != null) { var parent = processor.CallStack.DomainAdapter.GetValueAs <DomainAdapter>(); adapter.SetSystemUnderTest(new MethodPhrase(firstRow.Skip(2)).Evaluate(parent, processor)); } } return(fixture); }
void ComputeRow(CellProcessor processor, Tree <Cell> row) { var memberName = MemberName.NamedParameterPrefix + processor.ParseTree <Cell, MemberName>(headerRow.Branches.Last()); var parameterList = new List <Tree <Cell> >(); for (var i = 0; i < headerRow.Branches.Count - 1; i++) { parameterList.Add(new CellTreeLeaf(new GracefulName(headerRow.Branches[i].Value.Text).ToString())); parameterList.Add(row.Branches[i]); } var result = processor.Invoke(new TypedValue(SystemUnderTest), memberName, new EnumeratedTree <Cell>(parameterList)); new CellOperationImpl(processor).Check(result, row.Branches.Last()); }
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 ComputeRow(CellProcessor processor, Tree <Cell> row) { var memberName = processor.ParseTree <Cell, MemberName>(headerRow.Branches.Last()).WithNamedParameters(); var parameterList = new List <Tree <Cell> >(); for (var i = 0; i < headerRow.Branches.Count - 1; i++) { parameterList.Add(new CellTreeLeaf(new GracefulName(headerRow.ValueAt(i).Text).ToString())); parameterList.Add(row.Branches[i]); } var result = processor.Invoke(processor.CallStack.DomainAdapter, memberName, new EnumeratedTree <Cell>(parameterList)); processor.Check(result, row.Branches.Last()); }
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 object Evaluate(DomainAdapter theFixture, CellProcessor processor) { cells.ValueAt(0).SetAttribute(CellAttribute.Syntax, CellAttributeValue.SyntaxKeyword); var cellCount = cells.Branches.Count; if (cellCount < 2) { throw MakeException("missing cells"); } var identifier = cells.ValueAt(1).Text; if (newIdentifier.Equals(identifier)) { cells.ValueAt(1).SetAttribute(CellAttribute.Syntax, CellAttributeValue.SyntaxKeyword); return(new MethodPhrase(cells.Skip(1)).EvaluateNew(processor)); } if (typeIdentifier.Equals(identifier)) { cells.ValueAt(1).SetAttribute(CellAttribute.Syntax, CellAttributeValue.SyntaxKeyword); if (cellCount < 3) { throw MakeException("missing cells"); } cells.ValueAt(2).SetAttribute(CellAttribute.Syntax, CellAttributeValue.SyntaxSUT); return(processor.ParseTree(typeof(Type), cells.Branches[2]).Value); } if (currentIdentifier.Equals(identifier)) { cells.ValueAt(1).SetAttribute(CellAttribute.Syntax, CellAttributeValue.SyntaxKeyword); return(theFixture.SystemUnderTest); } var fixture = theFixture as FlowInterpreter; if (fixture == null) { throw MakeException("flow fixture required"); } return(processor.Get <Symbols>().HasValue(identifier) ? processor.Get <Symbols>().GetValue(identifier) : fixture.ExecuteFlowRowMethod(processor, cells)); }
string GetMemberName(Tree<Cell> members) { return processor.ParseTree<Cell, MemberName>(members).ToString(); }
MemberName GetMemberName(Tree <Cell> members) { return(processor.ParseTree <Cell, MemberName>(members)); }
public void Interpret(Tree <Cell> table) { var name = processor.ParseTree <Cell, MemberName>(new EnumeratedTree <Cell>(table.Branches[0].Branches.Skip(1).Alternate())); processor.Store(new Procedure(name.ToString(), table)); }
public void Interpret(CellProcessor processor, Tree<Cell> table) { processor.TestStatus.TableCount--; var name = processor.ParseTree<Cell, MemberName>(new EnumeratedTree<Cell>(table.Branches[0].Branches.Skip(1).Alternate())); processor.Get<Procedures>().Save(name.ToString(), table); }