/// <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; }
/// <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); }
/// <summary> /// Creates a boxed container. /// </summary> /// <param name="header">The header for the container.</param> /// <returns>Returns the new container.</returns> protected static HtmlControl CreateContainer(string header) { HtmlControl control = CreateContainer(); HtmlSpan txt = new HtmlSpan(); txt.InnerText = header; txt.SetStyleAttribute(CssAttribute.Display, CssDisplay.Block); control.Controls.Add(txt); return control; }
/// <summary> /// Appends text to the log, in a fixed-width font. /// </summary> /// <param name="value">The string to append.</param> protected void AppendFixedText(string value) { HtmlSpan span = new HtmlSpan(); WebBrowserTestPage.SetDefaultFixedFont(span); WebBrowserTestPage.SetDefaultFontSize(span); span.ForegroundColor = Color.LightGray; span.InnerHtml = value; _myLog.Controls.Add(span); _myLog.Controls.Add(new HtmlLineBreak()); }