/// <summary>
            /// Allow the Details control to decorate the parent container.
            /// </summary>
            /// <returns>Returns a set of control bases to decorate with.</returns>
            public override IEnumerable<HtmlControlBase> DecorateContainer()
            {
                string type = Inspector.Result.Exception.GetType().ToString();
                if (type.Contains(Utf))
                {
                    type = type.Remove(0, Utf.Length);
                }
                if (type.StartsWith("System.", StringComparison.OrdinalIgnoreCase))
                {
                    type = type.Substring(7);
                }
                string message = Inspector.Result.Exception.Message;

                HtmlSpan ce = new HtmlSpan();
                ce.InnerHtml = type;
                ce.SetStyleAttribute(CssAttribute.Display, CssDisplay.InlineBlock);
                ce.Margin.All = 2;
                ce.Padding.All = 4;
                ce.BackgroundColor = Color.Tan;
                yield return ce;

                HtmlSpan oc = new HtmlSpan();
                oc.InnerText = " occurred";
                yield return oc;

                HtmlDiv cm = new HtmlDiv();
                cm.Margin.All = 4;
                cm.Padding.All = 1;
                cm.InnerHtml = message;
                yield return cm;
            }
Esempio n. 2
0
        /// <summary>
        /// Creates a new test status control on the webpage, within the 
        /// parentElement.
        /// </summary>
        public CurrentTestStatus()
        {
            SetStyleAttribute(CssAttribute.Position, "relative");
            Height = 40;
            SetStyleAttribute(CssAttribute.MarginBottom, new Unit(6));
            BorderColor = Color.VeryLightGray;
            BorderStyle = BorderStyle.Solid;
            BorderWidth = 1;

            _status = new HtmlSpan();
            _status.Margin.All = 0;
            _status.Margin.Left = 4;
            _details = new HtmlSpan();
            _details.Margin.All = 0;
            _details.Margin.Left = 4;
            RevertFinalStyle();

            _total = CreateCounterDiv();
            _fail = CreateCounterDiv();
            _fail.SetStyleAttribute(CssAttribute.Right, new Unit(35, UnitType.Pixel));

            Controls.Add(_status);
            Controls.Add(new HtmlLineBreak());
            Controls.Add(_details);
            Controls.Add(_total);
            Controls.Add(_fail);
        }
Esempio n. 3
0
 /// <summary>
 /// The first failure calls this.
 /// </summary>
 private void FirstFailure()
 {
     HtmlDiv summaryHeader = new HtmlDiv();
     summaryHeader.InnerHtml = "Summary of Test Run Failures";
     summaryHeader.Padding.All = 2;
     summaryHeader.BackgroundColor = Color.DarkGray;
     summaryHeader.ForegroundColor = Color.VeryLightGray;
     Controls.Add(summaryHeader);
 }
Esempio n. 4
0
        /// <summary>
        /// Initializes the test harness.
        /// </summary>
        /// <param name="settings">The test harness settings object.</param>
        public override void Initialize(TestHarnessSettings settings)
        {
            base.Initialize(settings);

            RegisterLogHandlers();

            // Initializes the static provider control if it does not yet exist
            WebBrowserTestPage page = WebpageLogProviderBase.TestPage;

            // Simple div for logging
            _myLog = new HtmlDiv();
            _myLog.Padding.All = 0;
            page.TestColumn.Controls.Add(_myLog);
        }
Esempio n. 5
0
 /// <summary>
 /// Initializes the web control.
 /// </summary>
 private void InitializeComponent()
 {
     SetStyleAttribute(CssAttribute.Position, "relative");
     _progress = new HtmlDiv();
     _progress.SetStyleAttribute(CssAttribute.Position, "absolute");
     _progress.Position.Left = _progress.Position.Top = _progress.Position.Bottom = 0;
     SetProgressColor(Color.Black);
     MakeTransparent(_progress, 25);
     Controls.Add(_progress);
 }
Esempio n. 6
0
 /// <summary>
 /// Creates a boxed container.
 /// </summary>
 /// <returns>Returns the new container.</returns>
 protected static HtmlControl CreateContainer()
 {
     HtmlDiv container = new HtmlDiv();
     container.BorderColor = Color.VeryLightGray;
     container.BorderStyle = BorderStyle.Solid;
     container.BorderWidth = 1;
     container.Padding.All = 2;
     container.Margin.Bottom = container.Margin.Top = 1;
     return container;
 }
Esempio n. 7
0
            /// <summary>
            /// Populates and creates the controls for showing the detailed 
            /// information about the result.
            /// </summary>
            protected virtual void PopulateData()
            {
                HtmlControl actions = CreateContainer("Actions:");
                AddRetryAction(actions);
                AddCopyAction(actions);
            
                Controls.Add(TempCreateInformationGrid());
                if (Inspector.Result.Exception != null) 
                {
                    HtmlControl trace = CreateContainer("Stack trace:");
                    HtmlDiv traceText = new HtmlDiv();
                    traceText.InnerHtml = HttpUtility.HtmlEncode(Inspector.Result.Exception.StackTrace);
                    traceText.Height = 80;
                    traceText.SetStyleAttribute(CssAttribute.Overflow, "auto");
                    // TODO: Style as fixed text
                    trace.Controls.Add(traceText);

                    Controls.Add(trace);
                }
                Controls.Add(actions);

                DataLoaded = true;
            }
Esempio n. 8
0
        /// <summary>
        /// Process an event with granular properties.
        /// </summary>
        /// <param name="l">The log message object.</param>
        private void ProcessGranularEvent(LogMessage l)
        {
            TestGranularity granularity = (TestGranularity)l[LogDecorator.TestGranularity];
            HtmlDiv div = new HtmlDiv();
            div.InnerHtml = l.Message;
            div.Padding.All = 2;

            switch (granularity)
            {
                case TestGranularity.Harness:
                    div.BackgroundColor = Color.DarkGray;
                    div.ForegroundColor = Color.VeryLightGray;
                    break;

                case TestGranularity.TestScenario:
                case TestGranularity.Test:
                    break;

                case TestGranularity.TestGroup:
                    div.Font.Bold = true;
                    break;

                default:
                    div = null;
                    AppendFixedText(l.ToString());
                    break;
            }
            if (div != null)
            {
                _myLog.Controls.Add(div);
            }
        }
Esempio n. 9
0
 /// <summary>
 /// Appends simple text to the log.
 /// </summary>
 /// <param name="message">The message, HTML permitted.</param>
 /// <param name="foregroundColor">The optional foreground color, as a 
 /// string value.</param>
 /// <param name="backgroundColor">The optional background color, as a 
 /// string value.</param>
 protected void AddSimpleMessage(string message, string foregroundColor, string backgroundColor)
 {
     HtmlDiv div = new HtmlDiv();
     div.InnerHtml = message;
     div.Padding.All = 3;
     if (backgroundColor != null)
     {
         div.BackgroundColor = backgroundColor;
     }
     if (foregroundColor != null)
     {
         div.ForegroundColor = foregroundColor;
     }
     _myLog.Controls.Add(div);
 }
Esempio n. 10
0
 /// <summary>
 /// Creates a div that will contain a number counter.
 /// </summary>
 /// <returns>The HTML element of the counter.</returns>
 private static HtmlDiv CreateCounterDiv()
 {
     HtmlDiv elem = new HtmlDiv();
     elem.SetStyleAttribute(CssAttribute.Position, "absolute");
     elem.SetStyleAttribute(CssAttribute.Display, CssDisplay.Block);
     elem.Margin.Top = new Unit(4, UnitType.Pixel);
     elem.Position.Right = 1;
     elem.Position.Top = 1;
     elem.Padding.Top = 3;
     elem.Font.Size = new FontUnit(14, UnitType.Pixel);
     elem.SetStyleAttribute(CssAttribute.TextAlign, "center");
     elem.BorderColor = Color.White;
     elem.BorderStyle = BorderStyle.Solid;
     elem.BorderWidth = 1;
     elem.Width = 29;
     elem.Height = 23;
     elem.InnerHtml = String.Empty;
     return elem;
 }
Esempio n. 11
0
 /// <summary>
 /// Creates the indicator area.
 /// </summary>
 private void CreateIndicator()
 {
     _indicator = new HtmlDiv();
     _indicator.Position.Bottom = _indicator.Position.Left = _indicator.Position.Right = 0;
     _indicator.Height = new Unit(12, UnitType.Pixel);
     _indicator.CssClass = TestColumnIndicator;
     _indicator.SetStyleAttribute(CssAttribute.Position, "absolute");
     Controls.Add(_indicator);
 }