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
        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);
            }
        }