예제 #1
0
 bool MarkRows(IEnumerable<Tree<Cell>> expectedRows, Actuals actuals) {
     var markResult = true;
     var row = 0;
     foreach (var markRow in expectedRows) {
         if (strategy.IsOrdered && actuals.IsOutOfOrder(row)) {
             MarkAsIncorrect(markRow, "out of order");
             markResult = false;
         }
         else if (actuals.MatchValue(row) == null) {
             MarkAsIncorrect(markRow, "missing");
             markResult = false;
         }
         else {
             var matchValues = strategy.ActualValues(actuals.MatchValue(row));
             var cellNumber = 0;
             foreach (var cell in markRow.Branches) {
                 if (matchValues[cellNumber].Type != typeof(void) || cell.Value.Text.Length > 0) {
                     processor.Check(matchValues[cellNumber], cell);
                 }
                 cellNumber++;
             }
         }
         row++;
     }
     return markResult;
 }
예제 #2
0
        bool MarkRows(IEnumerable <Tree <Cell> > expectedRows, Actuals actuals)
        {
            var markResult = true;
            var row        = 0;

            foreach (var markRow in expectedRows)
            {
                if (strategy.IsOrdered && actuals.IsOutOfOrder(row))
                {
                    MarkAsIncorrect(markRow, "out of order");
                    markResult = false;
                }
                else if (actuals.MatchValue(row) == null)
                {
                    MarkAsIncorrect(markRow, "missing");
                    markResult = false;
                }
                else
                {
                    var matchValues = strategy.ActualValues(actuals.MatchValue(row));
                    var cellNumber  = 0;
                    foreach (var cell in markRow.Branches)
                    {
                        if (matchValues[cellNumber].Type != typeof(void) || cell.Value.Text.Length > 0)
                        {
                            processor.Check(matchValues[cellNumber], cell);
                        }
                        cellNumber++;
                    }
                }
                row++;
            }
            return(markResult);
        }
예제 #3
0
        public bool MarkCell(IEnumerable<object> theActualValue, Parse theTableRows)
        {
            var actuals = new Actuals(theActualValue, strategy);
            if (theTableRows.More == null && actuals.UnmatchedCount == 0) {
                processor.TestStatus.MarkRight(theTableRows);
            }
            bool result = true;
            int expectedRow = 0;
            foreach (Parse currentRow in new CellRange(theTableRows.More).Cells) {
                try {
                    int match = actuals.FindMatch(RowMatches, expectedRow, currentRow.Parts);
                    if (match < 0) {
                        MarkAsIncorrect(currentRow, "missing");
                        result = false;
                    }
                    expectedRow++;
                }
                catch (Exception e) {
                    processor.TestStatus.MarkException(currentRow.Parts, e);
                    return false;
                }
            }
            if (actuals.UnmatchedCount > 0 && !strategy.SurplusAllowed) {
                actuals.ShowSurplus(processor, theTableRows.Last);
                result = false;
            }

            Parse markRow = theTableRows.More;
            for (int row = 0; row < expectedRow; row++) {
                if (strategy.IsOrdered && actuals.IsOutOfOrder(row)) {
                    MarkAsIncorrect(markRow, "out of order");
                    result = false;
                }
                else if (actuals.Match(row) != null) {
                    TypedValue[] actualValues = strategy.ActualValues(actuals.Match(row));
                    int i = 0;
                    foreach (Parse cell in new CellRange(markRow.Parts).Cells) {
                        if (actualValues[i].Type != typeof(void) || cell.Text.Length > 0) {
                             new CellOperationImpl(processor).Check(actualValues[i], cell);

                        }
                        i++;
                    }
                }
                markRow = markRow.More;
            }

            if (!strategy.FinalCheck(processor.TestStatus)) return false;
            return result;
        }
예제 #4
0
        public bool MarkCell(IEnumerable <object> theActualValue, Parse theTableRows)
        {
            var actuals = new Actuals(theActualValue, strategy);

            if (theTableRows.More == null && actuals.UnmatchedCount == 0)
            {
                processor.TestStatus.MarkRight(theTableRows);
            }
            bool result      = true;
            int  expectedRow = 0;

            foreach (Parse currentRow in new CellRange(theTableRows.More).Cells)
            {
                try {
                    int match = actuals.FindMatch(RowMatches, expectedRow, currentRow.Parts);
                    if (match < 0)
                    {
                        MarkAsIncorrect(currentRow, "missing");
                        result = false;
                    }
                    expectedRow++;
                }
                catch (Exception e) {
                    processor.TestStatus.MarkException(currentRow.Parts, e);
                    return(false);
                }
            }
            if (actuals.UnmatchedCount > 0 && !strategy.SurplusAllowed)
            {
                actuals.ShowSurplus(processor, theTableRows.Last);
                result = false;
            }

            Parse markRow = theTableRows.More;

            for (int row = 0; row < expectedRow; row++)
            {
                if (strategy.IsOrdered && actuals.IsOutOfOrder(row))
                {
                    MarkAsIncorrect(markRow, "out of order");
                    result = false;
                }
                else if (actuals.Match(row) != null)
                {
                    TypedValue[] actualValues = strategy.ActualValues(actuals.Match(row));
                    int          i            = 0;
                    foreach (Parse cell in new CellRange(markRow.Parts).Cells)
                    {
                        if (actualValues[i].Type != typeof(void) || cell.Text.Length > 0)
                        {
                            new CellOperationImpl(processor).Check(actualValues[i], cell);
                        }
                        i++;
                    }
                }
                markRow = markRow.More;
            }

            if (!strategy.FinalCheck(processor.TestStatus))
            {
                return(false);
            }
            return(result);
        }