Esempio n. 1
0
		public override void DoRow(Parse row) {
			hadRowOperation = false;
			base.DoRow(row);
			if (!hadRowOperation) {
				clean();
			}
		}
Esempio n. 2
0
		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;
			}
		}
Esempio n. 3
0
 public void DoCheckOperation(Parse expectedValue, CellRange cells)
 {
     CellOperation.Check(GetTargetObject(),
                                 new CellRange(MethodCells(cells)),
                                 new CellRange(ParameterCells(cells)),
                                 expectedValue);
 }
Esempio n. 4
0
        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);
            }
        }
Esempio n. 5
0
        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);
        }
Esempio n. 6
0
 static Parse GetCellForColumn(Parse row, int col)
 {
     Parse cell = row.Parts;
     for (int i = 0; i < col; i++)
         cell = cell.More;
     return cell;
 }
Esempio n. 7
0
 public override void DoTable(Parse theTable)
 {
     if (Args.Length > 0) {
         string behavior = Args[0].Trim().ToLower();
         Processor.Configuration.GetItem<Settings>().Behavior = behavior;
     }
 }
Esempio n. 8
0
 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);
 }
Esempio n. 9
0
 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);
 }
Esempio n. 11
0
 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);
 }
Esempio n. 12
0
 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;
 }
Esempio n. 13
0
 public void DoCheckOperation(Parse expectedValue, CellRange cells)
 {
     CellOperation.Check(GetTargetObject(),
                                 MethodRowSelector.SelectMethodCells(cells),
                                 MethodRowSelector.SelectParameterCells(cells),
                                 expectedValue);
 }
Esempio n. 14
0
        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);
            }
        }
Esempio n. 15
0
 private void CheckRowSize(Parse theCells) {
     int expectedSize = myParameterCount + expectedCount + 1;
     if (theCells.Size < expectedSize ||
         (!IHaveNoteColumns && theCells.Size != expectedSize)) {
         throw new RowWidthException(expectedSize);
     }
 }
Esempio n. 16
0
 public static Parse TestResult(Parse theTest)
 {
     var story = new StoryTest(theTest);
     story.writer = story.SaveTestResult;
     story.Execute();
     return story.resultTables;
 }
Esempio n. 17
0
 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);
 }
Esempio n. 18
0
 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);
 }
Esempio n. 20
0
 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;
 }
Esempio n. 21
0
 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;
 }
Esempio n. 22
0
 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);
 }
Esempio n. 23
0
 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;
 }
Esempio n. 24
0
	    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);
	    }
Esempio n. 25
0
 public override void DoTable(Parse table)
 {
     if (isStandAlone) SetCollection(DatabaseTest.GetDataTable(
         Symbols,
         GetArgumentInput<String>(0),
         DbEnvironmentFactory.DefaultEnvironment).Rows.GetEnumerator());
     base.DoTable(table);
 }
Esempio n. 26
0
 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 ? "&nbsp;" : ((double)(split/1000.0)).ToString());
 }
Esempio n. 27
0
 void ExecuteOptionalMethod(MemberName theMethodName, Parse theCell) {
     try {
         Processor.Invoke(this, theMethodName, theCell); //todo: invokewiththrow?
     }
     catch (Exception e) { 
         TestStatus.MarkException(theCell, e);
     }
 }
Esempio n. 28
0
 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));
     }
 }
Esempio n. 30
0
		public override void DoCell(Parse cell, int column) {
			Binding binding = ColumnBindings[column];
			try {
				binding.Do(cell);
			} 
			catch(Exception e) {
				TestStatus.MarkException(cell, e);
			}
		}
Esempio n. 31
0
 public ParseList(Parse parse)
 {
     this.parse = parse;
 }
Esempio n. 32
0
 private static void Reset(Parse row)
 {
 }
Esempio n. 33
0
 private static string GetTypeOfOperation(Parse row)
 {
     return(row.Parts.Text.ToLower());
 }
Esempio n. 34
0
 protected virtual Parse tr(Parse parts, Parse more)
 {
     return(new Parse("tr", null, parts, more));
 }
Esempio n. 35
0
 protected virtual Parse td(string body, Parse more)
 {
     return(new Parse("td", info(body), null, more));
 }
Esempio n. 36
0
        private void Remove(Parse row)
        {
            string handler = new GracefulName(row.Parts.More.Text).IdentifierName.ToString();

            ((Service.Service)Processor).RemoveCellHandler(handler);
        }
Esempio n. 37
0
 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;
 }
Esempio n. 38
0
 Parse(Parse other)
     : base(other)
 {
     Parts = other.Parts;
 }