Beispiel #1
0
        public void WriteResults(StepResults results, ITestContext context)
        {
            if (!_cell.IsResult)
            {
                WritePreview(context);
                return;
            }

            var actual = results.HasActual(_cell.Key) ? results.GetActual(_cell.Key) : "MISSING";

            if (results.IsInException(_cell.Key))
            {
                Text("Error!");
                AddClass(HtmlClasses.EXCEPTION);

                return;
            }

            if (results.IsFailure(_cell.Key))
            {
                var expected = _step.Get(_cell.Key);
                string text = "{0}, but was '{1}'".ToFormat(expected, actual);
                Text(text);
                AddClass(HtmlClasses.FAIL);
            }
            else
            {
                Text(context.GetDisplay(actual));
                AddClass(HtmlClasses.PASS);
            }
        }
Beispiel #2
0
        private void writeVerificationResultRow(SetRow setRow, ITestContext context, bool ordered)
        {
            AddBodyRow(row =>
            {
                if (ordered)
                {
                    row.Cell(setRow.ActualOrder == 0 ? string.Empty : setRow.ActualOrder.ToString());
                }

                _table.Cells.Each(cell =>
                {
                    var display = context.GetDisplay(setRow.Values[cell.Key]);
                    row.Cell(display);
                });

                switch (setRow.Result)
                {
                case SetMatch.Match:
                    row.AddClass(HtmlClasses.PASS);

                    break;

                case SetMatch.Extra:
                    row.AddClass(HtmlClasses.FAIL);
                    var firstChild = row.FirstChild();
                    firstChild.Text("Extra:  " + firstChild.Text());
                    break;

                case SetMatch.Missing:
                    row.AddClass(HtmlClasses.FAIL);
                    var tag = row.FirstChild();
                    tag.Text("Missing:  " + tag.Text());
                    break;

                case SetMatch.OutOfOrder:
                    row.AddClass(HtmlClasses.FAIL);

                    string text = "Expected {0} but was {1}".ToFormat(setRow.ExpectedOrder, setRow.ActualOrder);
                    row.FirstChild().Text(text);
                    break;
                }

                row.FirstChild().AddClass("left-cell");
            });

            if (setRow.Step != null)
            {
                context.ResultsFor(setRow.Step).ForExceptionText(writeExceptionText);
            }
        }
Beispiel #3
0
        public void WriteResults(StepResults results, ITestContext context)
        {
            if (!_cell.IsResult)
            {
                WritePreview(context);

                if (results.IsInException(_cell.Key))
                {
                    AddClass(HtmlClasses.EXCEPTION);
                }

                return;
            }

            var expected = _step.Get(_cell.Key);

            if (results.IsInException(_cell.Key))
            {
                Text(expected);
                AddClass(HtmlClasses.EXCEPTION);

                return;
            }

            bool hasResult = results.HasActual(_cell.Key);

            if (!hasResult)
            {
                Text("{0} (no result)".ToFormat(expected));
                AddClass(HtmlClasses.EXCEPTION);
                return;
            }

            var actual = results.GetActual(_cell.Key);

            if (results.IsFailure(_cell.Key))
            {
                string text = "{0}, but was '{1}'".ToFormat(expected, actual);
                Text(text);
                AddClass(HtmlClasses.FAIL);
            }
            else
            {
                Text(context.GetDisplay(actual));
                AddClass(HtmlClasses.PASS);
            }
        }
Beispiel #4
0
 public void WritePreview(ITestContext context)
 {
     string display = _cell.GetDisplay(_step);
     Text(context.GetDisplay(display));
 }
        private void writeVerificationResultRow(SetRow setRow, ITestContext context, bool ordered)
        {
            AddBodyRow(row =>
            {
                if (ordered)
                {
                    row.Cell(setRow.ActualOrder == 0 ? string.Empty : setRow.ActualOrder.ToString());
                }

                _table.Cells.Each(cell =>
                {
                    var display = context.GetDisplay(setRow.Values[cell.Key]);
                    row.Cell(display);
                });

                switch (setRow.Result)
                {
                    case SetMatch.Match:
                        row.AddClass(HtmlClasses.PASS);

                        break;

                    case SetMatch.Extra:
                        row.AddClass(HtmlClasses.FAIL);
                        var firstChild = row.FirstChild();
                        firstChild.Text("Extra:  " + firstChild.Text());
                        break;

                    case SetMatch.Missing:
                        row.AddClass(HtmlClasses.FAIL);
                        var tag = row.FirstChild();
                        tag.Text("Missing:  " + tag.Text());
                        break;

                    case SetMatch.OutOfOrder:
                        row.AddClass(HtmlClasses.FAIL);

                        string text = "Expected {0} but was {1}".ToFormat(setRow.ExpectedOrder, setRow.ActualOrder);
                        row.FirstChild().Text(text);
                        break;
                }

                row.FirstChild().AddClass("left-cell");
            });

            if (setRow.Step != null)
            {
                context.ResultsFor(setRow.Step).ForExceptionText(writeExceptionText);
            }
        }
Beispiel #6
0
        public void WritePreview(ITestContext context)
        {
            string display = _cell.GetDisplay(_step);

            Text(context.GetDisplay(display));
        }