예제 #1
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);
 }
예제 #2
0
            /// <summary>
            /// Adds the copy information action.
            /// </summary>
            /// <param name="actions">The action container.</param>
            private void AddCopyAction(HtmlControl actions)
            {
                HtmlAnchor copy = new HtmlAnchor(
                    "Copy result details",
                    delegate(object sender, HtmlEventArgs args)
                    {
			    //HtmlPage.Window.Alert(Inspector.Result.ToString());
                    });
                StyleActionLink(copy);
                actions.Controls.Add(copy);
            }
예제 #3
0
파일: FailureControl.cs 프로젝트: dfr0/moon
        /// <summary>
        /// Records a failure and modifies the web page to allow linking between
        /// the failure summary, and also next and previous failure 
        /// functionality.
        /// </summary>
        /// <param name="method">Unit test provider's method reference.</param>
        /// <param name="methodNextSpan">Span that will contain the next button.</param>
        public void AddMethodFailure(ITestMethod method, HtmlControl methodNextSpan)
        {
            string id = PrefixIdentifier + _summary.GenerateNextFailureId().ToString(CultureInfo.InvariantCulture);

            HtmlAnchor anchor = new HtmlAnchor(id);
            StyleAnchor(anchor);
            anchor.Id = id;
            methodNextSpan.Controls.Add(anchor);

            // Link to the previous failure
            //---
            if (_summary.FirstFailureEntry != null)
            {
                HtmlAnchor prev = new HtmlAnchor();
                StyleAnchor(prev);
                prev.Href = "#" + _summary.LastFailureEntry.Id;
                prev.Title = "Previous Failure";
                prev.Font.Underline = false;
                prev.ForegroundColor = Color.White;
                prev.InnerHtml = "&uarr;";

                methodNextSpan.Controls.Add(prev);
            }

            // Link to the next failure
            //---
            if (_summary.LastFailureEntry != null)
            {
                HtmlAnchor next = new HtmlAnchor();
                StyleAnchor(next);
                next.Href = "#" + id;
                next.Title = "Next Failure";
                next.Font.Underline = false;
                next.ForegroundColor = Color.White;
                next.InnerHtml = "&nbsp; &darr;";
                
                _summary.LastFailureEntry.Element.Controls.Add(next);
            }

            // The failure summary link
            //---
            HtmlAnchor link = new HtmlAnchor();
            StyleAnchor(link);
            link.Href = "#" + id;
            link.Display = CssDisplay.Block;
            link.InnerHtml = method.Name;
            Controls.Add(link);

            // Store this most recent failure's data
            //---
            _summary.LastFailureEntry = new FailureEntry
            {
                Id = id,
                Element = methodNextSpan
            };

            // Set the first entry if this is the first
            //---
            if (_summary.FirstFailureEntry == null)
            {
                _summary.FirstFailureEntry = _summary.LastFailureEntry;
            }
        }
예제 #4
0
 /// <summary>
 /// Adds the retry action link.
 /// </summary>
 /// <param name="actions">The action container.</param>
 private void AddRetryAction(HtmlControl actions)
 {
     HtmlAnchor rerun = new HtmlAnchor(
         "Retry this test",
         delegate(object sender, HtmlEventArgs args)
         {
             RetryTestRunFilter retryFilter = new RetryTestRunFilter(Inspector.Result.TestClass, Inspector.Result.TestMethod);
             UnitTestHarness ut = UnitTestHarness;
             if (ut != null)
             {
                 ut.RestartRunDispatcher();
                 ut.EnqueueTestAssembly(Inspector.Result.TestClass.Assembly, retryFilter);
             }
         });
     StyleActionLink(rerun);
     actions.Controls.Add(rerun);
 }
예제 #5
0
파일: FailureControl.cs 프로젝트: dfr0/moon
 /// <summary>
 /// Styles the anchors used for this control.
 /// </summary>
 /// <param name="anchor">The anchor control.</param>
 private static void StyleAnchor(HtmlAnchor anchor)
 {
     anchor.ForegroundColor = Color.DarkGray;
 }