Exemplo n.º 1
0
 public override void DoRow(Parse row)
 {
     if (row.Parts.Size != rowWidth)
     {
         TestStatus.MarkException(row.Parts, new RowWidthException(rowWidth));
     }
     else
     {
         try {
             TypedValue result = CellOperation.Invoke(this, memberNameCells,
                                                      valueCells.GetCells(new CellRange(row.Parts).Cells), row.Parts);
             if (result.Type != typeof(bool))
             {
                 throw new InvalidMethodException(string.Format("Method does not return boolean."));
             }
             if (result.GetValue <bool>() == expectedCondition)
             {
                 TestStatus.MarkRight(row);
             }
             else
             {
                 TestStatus.MarkWrong(row);
             }
         }
         catch (ParseException <Cell> e) {
             TestStatus.MarkException(e.Subject, e.InnerException);
         }
     }
 }
Exemplo n.º 2
0
 public object ExecuteEmbeddedMethod(Parse theCells)
 {
     try {
         CellRange cells = CellRange.GetMethodCellRange(theCells, 0);
         return
             (CellOperation.Invoke(this, new CellRange(MethodCells(cells)), new CellRange(ParameterCells(cells)), theCells.More).
              Value);
     }
     catch (ParseException <Cell> e) {
         TestStatus.MarkException(e.Subject, e.InnerException);
         throw new IgnoredException();
     }
 }
Exemplo n.º 3
0
        // Traversal ////////////////////////////////

        public override void DoCells(Parse cells)
        {
            this.cells = cells;
            try
            {
                targetObject = this;
                CellOperation.Invoke(this, cells);
                targetObject = actor;
            }
            catch (Exception e)
            {
                TestStatus.MarkException(cells, e);
            }
        }
Exemplo n.º 4
0
 public override void DoRow(Parse theRow)
 {
     try {
         if (theRow.Parts.Size != headerCells.Size)
         {
             throw new FitFailureException(String.Format("Row should be {0} cells wide.", headerCells.Size));
         }
         CellOperation.Invoke(this, new CellRange(headerCells), new CellRange(theRow.Parts), theRow.Parts);
     }
     catch (MemberMissingException e) {
         TestStatus.MarkException(headerCells, e);
         throw new IgnoredException();
     }
     catch (Exception e) {
         TestStatus.MarkException(theRow.Parts, e);
     }
 }
Exemplo n.º 5
0
        void AddSurplusRow(Parse rows, object extraObject)
        {
            Parse cell = null;

            SetTargetObject(extraObject);
            foreach (Parse headerCell in new CellRange(headerCells).Cells)
            {
                TypedValue actual  = CellOperation.Invoke(this, headerCell);
                var        newCell = (Parse)Processor.Compose(actual.Value ?? "null");
                if (cell == null)
                {
                    cell = newCell;
                }
                else
                {
                    cell.Last.More = newCell;
                }
            }
            AddRowToTable(cell, rows);
            MarkRowAsSurplus(rows.Last);
        }
Exemplo n.º 6
0
        bool IsMatch(Parse row, int col)
        {
            TypedValue actual = CellOperation.Invoke(this, headerCells.At(col));

            return(CellOperation.Compare(actual, GetCellForColumn(row, col)));
        }
Exemplo n.º 7
0
 public static TypedValue Invoke(this CellOperation operation, object target, Tree <Cell> memberName)
 {
     return(operation.Invoke(target, memberName, new CellTree()));
 }
Exemplo n.º 8
0
 public virtual void Press()
 {
     CellOperation.Invoke(actor, cells.More, new CellTree(), cells.More);
 }