public override void DoRow(Parse row) { hadRowOperation = false; base.DoRow(row); if (!hadRowOperation) { clean(); } }
private void RunRow(Parse row) { Parse cell = row.Parts; //first set input params for (int col = 0; col < columnAccessors.Length; col++) { Accessor accessor = columnAccessors[col]; ICellHandler cellHandler = CellOperation.GetHandler(this, cell, accessor.ParameterType); if (!isOutputColumn[col]) { cellHandler.HandleInput(this, cell, accessor); } cell = cell.More; } command.ExecuteNonQuery(); cell = row.Parts; //next evaluate output params for (int col=0; col<columnAccessors.Length; col++) { Accessor accessor=columnAccessors[col]; ICellHandler cellHandler = CellOperation.GetHandler(this,cell, accessor.ParameterType); if (isOutputColumn[col]) { cellHandler.HandleCheck(this, cell, accessor); } cell = cell.More; } }
public void DoCheckOperation(Parse expectedValue, CellRange cells) { CellOperation.Check(GetTargetObject(), new CellRange(MethodCells(cells)), new CellRange(ParameterCells(cells)), expectedValue); }
public override void DoRow(Parse theRow) { try { CheckRowSize(theRow.Parts); for (int j = 0; j < expectedCount; j++) { var memberCells = new List<Parse> { headerCells.At(j) }; foreach (Parse cell in methodSuffixCells.Cells) memberCells.Add(cell); Parse expectedCell = theRow.Parts.At(myParameterCount + j + 1); try { CellOperation.Check(GetTargetObject(), new CellRange(memberCells), myValues.GetCells(new CellRange(theRow.Parts, myParameterCount).Cells), expectedCell); } catch (MemberMissingException e) { TestStatus.MarkException(headerCells.At(j), e); TestStatus.MarkIgnore(expectedCell); } catch (IgnoredException) { TestStatus.MarkIgnore(expectedCell); } catch (Exception e) { TestStatus.MarkException(expectedCell, e); } } } catch (Exception e) { TestStatus.MarkException(theRow.Parts, e); } }
public String ResultingHTML() { Parse table = new Parse(OriginalHTML); Parse row = table.at(0, Row - 1); Parse cell = row.at(0, Column - 1); if (OverwriteCellBody != null) cell.body = OverwriteCellBody; if (AddToCellBody != null) cell.addToBody(AddToCellBody); if (OverwriteCellTag != null) cell.tag = OverwriteCellTag; if (OverwriteEndCellTag != null) cell.end = OverwriteEndCellTag; if (AddToCellTag != null) cell.addToTag(stripDelimiters(AddToCellTag)); if (OverwriteRowTag != null) row.tag = OverwriteRowTag; if (OverwriteEndRowTag != null) row.end = OverwriteEndRowTag; if (AddToRowTag != null) row.addToTag(stripDelimiters(AddToRowTag)); if (OverwriteTableTag != null) table.tag = OverwriteTableTag; if (OverwriteEndTableTag != null) table.end = OverwriteEndTableTag; if (AddToTableTag != null) table.addToTag(stripDelimiters(AddToTableTag)); if (AddCellFollowing != null) addParse(cell, AddCellFollowing, new String[] {"td"}); if (RemoveFollowingCell != null) removeParse(cell); if (AddRowFollowing != null) addParse(row, AddRowFollowing, new String[] {"tr", "td"}); if (RemoveFollowingRow != null) removeParse(row); if (AddTableFollowing != null) addParse(table, AddTableFollowing, new String[] {"table", "tr", "td"}); return GenerateOutput(table); }
static Parse GetCellForColumn(Parse row, int col) { Parse cell = row.Parts; for (int i = 0; i < col; i++) cell = cell.More; return cell; }
public override void DoTable(Parse theTable) { if (Args.Length > 0) { string behavior = Args[0].Trim().ToLower(); Processor.Configuration.GetItem<Settings>().Behavior = behavior; } }
public override void DoRows(Parse theRows) { if (theRows == null) throw new TableStructureException("No header row."); ExamineTableStructure(theRows.Parts); if (expectedCount == 0) return; myValues = new ValueArray(RepeatString); base.DoRows(theRows.More); }
public ParseTree(Parse theParse) { tree = new ListTree(GetTitle(theParse)); for (Parse child = Root(theParse).Parts; child != null; child = child.More) { tree.AddChild(new ParseTree(child)); } myHashCode = theParse.ToString().GetHashCode(); }
public override void DoRow(Parse row) { FitRow fRow = new FitRow(row); TableHandler.ProcessRow(fRow); HandleRowResult(ref row); }
public void testIterating() { Parse p = new Parse("leader<table><tr><td>one</td><td>two</td><td>three</td></tr></table>trailer"); Assert.AreEqual("one", p.parts.parts.body); Assert.AreEqual("two", p.parts.parts.more.body); Assert.AreEqual("three", p.parts.parts.more.more.body); }
private Parse AddRow(Parse lastRow, DataRow dr, bool markAsError, String desc) { Parse newRow = new Parse("tr", null, null, null); lastRow.More = newRow; lastRow = newRow; try { Parse firstCell = new Parse("td", GetStringValue(dr, columnNames[0]), null, null); newRow.Parts = firstCell; if (markAsError) { firstCell.AddToBody(Fixture.Gray(desc)); this.Wrong(firstCell); } for (int i = 1; i < columnNames.Length; i++) { Parse nextCell = new Parse("td", GetStringValue(dr, columnNames[i]), null, null); firstCell.More = nextCell; firstCell = nextCell; } } catch (Exception e) { this.Exception(newRow, e); } return lastRow; }
public void DoCheckOperation(Parse expectedValue, CellRange cells) { CellOperation.Check(GetTargetObject(), MethodRowSelector.SelectMethodCells(cells), MethodRowSelector.SelectParameterCells(cells), expectedValue); }
public override void DoRow(Parse theRow) { try { CheckRowSize(theRow.Parts); for (int j = 0; j < expectedCount; j++) { var memberCells = new CellTree(); memberCells.AddBranch(headerCells.At(j)); foreach (var suffixCell in methodSuffixCells.Cells) { memberCells.AddBranch(suffixCell); } Parse expectedCell = theRow.Parts.At(myParameterCount + j + 1); try { Processor.Check(GetTargetObject(), memberCells, myValues.GetCells(theRow.Branches.Take(myParameterCount)), expectedCell); } catch (MemberMissingException e) { TestStatus.MarkException(headerCells.At(j), e); TestStatus.MarkIgnore(expectedCell); } catch (IgnoredException) { TestStatus.MarkIgnore(expectedCell); } catch (Exception e) { TestStatus.MarkException(expectedCell, e); } } } catch (Exception e) { TestStatus.MarkException(theRow.Parts, e); } }
private void CheckRowSize(Parse theCells) { int expectedSize = myParameterCount + expectedCount + 1; if (theCells.Size < expectedSize || (!IHaveNoteColumns && theCells.Size != expectedSize)) { throw new RowWidthException(expectedSize); } }
public static Parse TestResult(Parse theTest) { var story = new StoryTest(theTest); story.writer = story.SaveTestResult; story.Execute(); return story.resultTables; }
public void testRecursing() { Parse p = new Parse("leader<table><TR><Td>body</tD></TR></table>trailer"); Assert.AreEqual(null, p.body); Assert.AreEqual(null, p.parts.body); Assert.AreEqual("body", p.parts.parts.body); }
public static Parse MakeCells(params object[] theContents) { Parse cells = null; for (int i = theContents.Length-1; i >=0; i--) { cells = new Parse("td", theContents[i].ToString(), null, cells); } return cells; }
public override void DoTable(Parse table) { var rows = table.Parts.More; if (rows == null) throw new TableStructureException("Header row missing."); myHeaderRow = rows; CompareRows(table, 1); }
public static Parse MakeRows(params object[] theCells) { Parse rows = null; for (int i = theCells.Length-1; i >=0; i--) { rows = new Parse("tr", null, (Parse)theCells[i], rows); } return rows; }
public static Parse MakeTables(params object[] theRows) { Parse tables = null; for (int i = theRows.Length-1; i >=0; i--) { tables = new Parse("table", null, (Parse)theRows[i], tables); } return tables; }
public void TestParsing() { Parse p = new Parse("leader<Table foo=2>body</table>trailer", new string[] {"table"}); Assert.AreEqual("leader", p.leader); Assert.AreEqual("<Table foo=2>", p.tag); Assert.AreEqual("body", p.body); Assert.AreEqual("trailer", p.trailer); }
private void addParse(Parse parse, String newString, String[] tags) { Parse newParse = new Parse(newString, tags); newParse.more = parse.more; newParse.trailer = parse.trailer; parse.more = newParse; parse.trailer = null; }
private void InspectProcedure(Parse table) { Dictionary<String, DbParameterAccessor> allParams= environment.GetAllProcedureParameters(objectName); if (allParams.Count==0){ throw new ApplicationException("Cannot retrieve list of parameters for procedure "+objectName + " - check spelling and access rights"); } addRowWithParamNames(table,allParams); }
public override void DoTable(Parse table) { if (isStandAlone) SetCollection(DatabaseTest.GetDataTable( Symbols, GetArgumentInput<String>(0), DbEnvironmentFactory.DefaultEnvironment).Rows.GetEnumerator()); base.DoTable(table); }
public override void doCells(Parse cells) { DateTime start = time(); base.doCells(cells); long split = time().Ticks - start.Ticks; cells.last().more = td(start.ToString(format)); cells.last().more = td(split<1000 ? " " : ((double)(split/1000.0)).ToString()); }
void ExecuteOptionalMethod(MemberName theMethodName, Parse theCell) { try { Processor.Invoke(this, theMethodName, theCell); //todo: invokewiththrow? } catch (Exception e) { TestStatus.MarkException(theCell, e); } }
protected void Bind(Parse headerCells) { var factory = new BindingFactory(Processor, this, GetTargetObject()); ColumnBindings = new Binding[headerCells.Size]; for (int i = 0; headerCells != null; i++, headerCells = headerCells.More) { ColumnBindings[i] = new Binding(factory.Make(headerCells)).BeforeCheck(CheckCalled); } }
private void ReadColumnNames(Parse headerCells) { accessors = new DataColumnAccessor[headerCells.Size]; for (int i = 0; headerCells != null; i++, headerCells = headerCells.More) { String columnName = NameNormaliser.NormaliseName(headerCells.Text); accessors[i] = new DataColumnAccessor(GetColumn(columnName), !checkIsImpliedByRegex.IsMatch(headerCells.Text)); } }
public override void DoCell(Parse cell, int column) { Binding binding = ColumnBindings[column]; try { binding.Do(cell); } catch(Exception e) { TestStatus.MarkException(cell, e); } }
public ParseList(Parse parse) { this.parse = parse; }
private static void Reset(Parse row) { }
private static string GetTypeOfOperation(Parse row) { return(row.Parts.Text.ToLower()); }
protected virtual Parse tr(Parse parts, Parse more) { return(new Parse("tr", null, parts, more)); }
protected virtual Parse td(string body, Parse more) { return(new Parse("td", info(body), null, more)); }
private void Remove(Parse row) { string handler = new GracefulName(row.Parts.More.Text).IdentifierName.ToString(); ((Service.Service)Processor).RemoveCellHandler(handler); }
public Parse(string text, string theTag, string theEnd, string theLeader, string theBody, Parse theParts) : base(text) { tag = theTag; End = theEnd; Leader = theLeader; body = theBody; Parts = theParts; }
Parse(Parse other) : base(other) { Parts = other.Parts; }