Ejemplo 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");
                    }
                }
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Test method start code.
        /// </summary>
        /// <param name="l">The log message.</param>
        private void TestMethodStart(LogMessage l)
        {
            ITestMethod method  = (ITestMethod)l[UnitTestLogDecorator.TestMethodMetadata];
            string      name    = TruncateNameIfNeeded(l.Message);
            string      details = string.IsNullOrEmpty(method.Description) ? l.Message : l.Message + ": " + method.Description;

            HtmlContainerControl elem   = CreateText();
            HtmlAnchor           anchor = new HtmlAnchor();

            anchor.InnerHtml      = name;
            anchor.Title          = details;
            anchor.Font.Underline = false;
            anchor.SetStyleAttribute(CssAttribute.BorderBottom, "1px dotted #aaa");
            elem.Controls.Add(anchor);
            // elem.BackgroundColor = Color.White;
            _startElements[method] = elem;

            LogContainer.Controls.Add(elem);
        }
Ejemplo n.º 3
0
 /// <summary>
 /// Customizes the anchor for action use.
 /// </summary>
 /// <param name="anchor">The anchor.</param>
 private static void StyleActionLink(HtmlAnchor anchor)
 {
     anchor.SetStyleAttribute(CssAttribute.Display, CssDisplay.Block);
 }