Exemplo n.º 1
0
        /// <summary>
        /// Process a UTF result message.
        /// </summary>
        /// <param name="logMessage">The log message object.</param>
        private void ProcessResult(LogMessage logMessage)
        {
            if (logMessage.HasDecorator(UnitTestLogDecorator.TestMethodMetadata))
            {
                ScenarioResult result  = (ScenarioResult)logMessage[UnitTestLogDecorator.ScenarioResult];
                TestOutcome    outcome = result.Result;
                ITestMethod    method  = result.TestMethod;
                ITestClass     test    = result.TestClass;

                if (_startElements.ContainsKey(method))
                {
                    HtmlContainerControl elem = _startElements[method];
                    ++_statusDisplay.Total;
                    IncrementScenarioCounter();

                    switch (outcome)
                    {
                    case TestOutcome.Passed:
                    case TestOutcome.PassedButRunAborted:
                        break;

                    case TestOutcome.Inconclusive:
                    case TestOutcome.Failed:
                        elem.BackgroundColor = Color.Red;
                        elem.ForegroundColor = Color.White;
                        elem.Font.Bold       = true;
                        ++_statusDisplay.Fail;

                        HtmlContainerControl nextSpan = CreateText(/* isDiv */ false);
                        nextSpan.SetStyleAttribute(CssAttribute.Position, "absolute");
                        nextSpan.SetStyleAttribute(CssAttribute.Right, new Unit(10));
                        elem.Controls.Add(nextSpan);

                        _failureSummary.AddFailure(test, method, nextSpan);
                        break;

                    default:
                        break;
                    }
                    _startElements.Remove(method);

                    // Hook up the details inspection control to the name
                    HtmlAnchor anchor = FindFirstChildElement <HtmlAnchor>(elem);
                    if (anchor != null)
                    {
                        ResultInspector inspector = new ResultInspector(result);
                        LogContainer.Controls.Add(inspector);
                        //anchor.Click += (sender, args) => inspector.ToggleDropDown();
                        anchor.SetStyleAttribute(CssAttribute.Cursor, "hand");
                    }
                }
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Test class start code.
        /// </summary>
        /// <param name="l">Log message.</param>
        private void TestClassStart(LogMessage l)
        {
            //// ITestClass tclass = (ITestClass)l[UnitTestLogDecorator.TestClassMetadata];
            HtmlContainerControl e = CreateText();

            e.InnerHtml       = "<em>" + l.Message + "</em>";
            e.BackgroundColor = Color.Manila;
            e.SetStyleAttribute(CssAttribute.Border, "1px solid " + Color.ManilaBorder);
            e.Font.Bold       = true;
            e.ForegroundColor = Color.DarkGray;
            e.SetStyleAttribute("borderBottom", "2px solid " + Color.Tan);
            e.Margin.Top = 3;
            LogContainer.Controls.Add(e);

            _statusDisplay.UpdateDetails(TruncateNameIfNeeded(l.Message));
        }
Exemplo n.º 3
0
        /// <summary>
        /// Process an Exception that was not the expected Exception type.
        /// </summary>
        /// <param name="l">The log message.</param>
        private void ProcessIncorrectException(LogMessage l)
        {
            string html = l.ToString();

            HtmlContainerControl text = CreateText();

            text.InnerHtml       = html;
            text.BackgroundColor = Color.Manila;
            text.SetStyleAttribute(CssAttribute.Border, "1px solid " + Color.ManilaBorder);
            text.ForegroundColor = Color.DarkGray;
            LogContainer.Controls.Add(text);
        }