private static void AssertQuery(string columnName, string headerCellName) { var dataTable = new DataTable(); dataTable.Columns.Add("somekey", typeof(string)); dataTable.Columns.Add(columnName, typeof(string)); var newRow = dataTable.NewRow(); newRow["somekey"] = "key"; newRow[columnName] = "value"; dataTable.Rows.Add(newRow); var fixture = new Query(dataTable, false) { Processor = new Service() }; var testTable = new CellTree( new CellTree("query"), new CellTree("somekey", headerCellName), new CellTree("key", "value") ); Parse parseTable = Parse.CopyFrom(testTable); fixture.DoTable(parseTable); Assert.AreEqual(TestStatus.Right, parseTable.At(0, 2, 0).GetAttribute(CellAttribute.Status)); Assert.AreEqual(TestStatus.Right, parseTable.At(0, 2, 1).GetAttribute(CellAttribute.Status)); }
private void ExamineTableStructure(Parse theHeaderCells) { expectedCount = 0; IHaveNoteColumns = false; try { myParameterCount = CountParameterCells(theHeaderCells); methodSuffixCells = new CellRange(theHeaderCells, myParameterCount); headerCells = theHeaderCells.At(myParameterCount + 1); foreach (Parse headerCell in new CellRange(theHeaderCells.At(myParameterCount + 1)).Cells) { if (headerCell.Text.Length == 0) { IHaveNoteColumns = true; break; } expectedCount++; } } catch (Exception e) { TestStatus.MarkException(theHeaderCells, e); } }
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 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 Parse Cell(int theRow, int theCell) { Parse row = myParse.Parts; if (row == null || theRow >= row.Size) { return(null); } Parse cell = row.At(theRow).Parts; if (cell == null || theCell >= cell.Size) { return(null); } return(cell.At(theCell)); }
public override void DoCell(Parse cell, int column) { currentHeader = headerCells.At(column); base.DoCell(cell, column); }
protected Parse GetCell(int row, int column) { return(rows.At(row, column)); }
public void TestOneExpectedOneActualCorrect() { const string name = "Joe"; AddQueryValue(new RowFixturePerson(name)); AddRow(new[] { name }); RunTest(); VerifyCounts(1, 0, 0, 0); AssertTextInTag(table.At(0, 2, 0), TestStatus.Right); }
public void TestRight() { Assert.AreEqual(1, resultCounts.GetCount(TestStatus.Right)); Assert.AreEqual(TestStatus.Right, finishedTable.At(0,1,0).GetAttribute(CellAttribute.Status)); }
protected void DoEmbeddedTable(Parse theTable) { Parse heading = theTable.At(0, 0, 0); if (heading != null) { try { Fixture fixture = LoadFixture(heading.Text); RunFixture(theTable, fixture); } catch (Exception e) { Exception(heading, e); } } }
protected void ProcessFirstTable(Parse theTable) { try { base.DoTable(theTable); } catch (FitFailureException ex) { Failure(theTable.At(0, 0, 0), ex.Message); } catch (IgnoredException) { } }
public void TestIndexingPage() { Parse p = new Parse( @"leader <table> <tr> <td>one</td><td>two</td><td>three</td> </tr> <tr> <td>four</td> </tr> </table> trailer"); Assert.AreEqual("one", p.At(0,0,0).Body); Assert.AreEqual("two", p.At(0,0,1).Body); Assert.AreEqual("three", p.At(0,0,2).Body); Assert.AreEqual("three", p.At(0,0,3).Body); Assert.AreEqual("three", p.At(0,0,4).Body); Assert.AreEqual("four", p.At(0,1,0).Body); Assert.AreEqual("four", p.At(0,1,1).Body); Assert.AreEqual("four", p.At(0,2,0).Body); Assert.AreEqual(1, p.Size); Assert.AreEqual(2, p.Parts.Size); Assert.AreEqual(3, p.Parts.Parts.Size); Assert.AreEqual("one", p.Leaf.Body); Assert.AreEqual("four", p.Parts.Last.Leaf.Body); }