Exemplo n.º 1
0
        public static HtmlTextWriter AddTestEvents(this HtmlTextWriter writer, NunitGoTest nunitGoTest, string id = "")
        {
            writer.AddAttribute(HtmlTextWriterAttribute.Id, id.Equals("") ? "table-cell" : id);
            writer.AddStyleAttribute(HtmlTextWriterStyle.Padding, "20px");
            writer.RenderBeginTag(HtmlTextWriterTag.Div);
            var events = nunitGoTest.Events.OrderBy(x => x.Started);
            foreach (var testEvent in events)
            {
                writer.RenderBeginTag(HtmlTextWriterTag.P);
                writer.AddTag(HtmlTextWriterTag.B, "Test event: ");
                writer.Write(testEvent.Name);
                writer.RenderEndTag(); //P

                writer.RenderBeginTag(HtmlTextWriterTag.P);
                writer.Write(Bullet.HtmlCode + "Started: " + testEvent.Started.ToString("dd.MM.yy HH:mm:ss.fff"));
                writer.RenderEndTag();
                writer.RenderBeginTag(HtmlTextWriterTag.P);
                writer.Write(Bullet.HtmlCode + "Finished: " + testEvent.Finished.ToString("dd.MM.yy HH:mm:ss.fff"));
                writer.RenderEndTag();
                writer.RenderBeginTag(HtmlTextWriterTag.P);
                writer.Write(Bullet.HtmlCode + "Duration: " + testEvent.DurationString);
                writer.RenderEndTag();

            }
            if (!events.Any())
                writer.Write("There are no test events in this test");
            writer.RenderEndTag();//DIV
            return writer;
        }
Exemplo n.º 2
0
 public static HtmlTextWriter AddEnvironment(this HtmlTextWriter writer, string id = "")
 {
     writer.AddAttribute(HtmlTextWriterAttribute.Id, id.Equals("") ? "table-cell" : id);
     writer.AddStyleAttribute(HtmlTextWriterStyle.Padding, "20px");
     writer.RenderBeginTag(HtmlTextWriterTag.Div);
     writer.AddTag(HtmlTextWriterTag.B, "Environment information: ");
     writer.RenderBeginTag(HtmlTextWriterTag.P);
     writer.Write(Bullet.HtmlCode + "CLR version: " + Environment.Version);
     writer.RenderEndTag();
     writer.RenderBeginTag(HtmlTextWriterTag.P);
     writer.Write(Bullet.HtmlCode + "OS version: " + Environment.OSVersion.VersionString);
     writer.RenderEndTag();
     writer.RenderBeginTag(HtmlTextWriterTag.P);
     writer.Write(Bullet.HtmlCode + "Platform: " + Environment.OSVersion.Platform);
     writer.RenderEndTag();
     writer.RenderBeginTag(HtmlTextWriterTag.P);
     writer.Write(Bullet.HtmlCode + "Machine name: " + Environment.MachineName);
     writer.RenderEndTag();
     writer.RenderBeginTag(HtmlTextWriterTag.P);
     writer.Write(Bullet.HtmlCode + "User domain: " + Environment.UserDomainName);
     writer.RenderEndTag();
     writer.RenderBeginTag(HtmlTextWriterTag.P);
     writer.Write(Bullet.HtmlCode + "User: " + Environment.UserName);
     writer.RenderEndTag();
     writer.RenderEndTag();//DIV
     return writer;
 }
Exemplo n.º 3
0
        public static HtmlTextWriter AddTestResult(this HtmlTextWriter writer, NunitGoTest nunitGoTest, string id = "")
        {
            writer.AddAttribute(HtmlTextWriterAttribute.Id, id.Equals("") ? "table-cell" : id);
            writer.AddStyleAttribute(HtmlTextWriterStyle.Padding, "20px");
            writer.RenderBeginTag(HtmlTextWriterTag.Div);

            writer.RenderBeginTag(HtmlTextWriterTag.P);
            writer.AddTag(HtmlTextWriterTag.B, "Test full name: ");
            writer.Write(nunitGoTest.FullName);
            writer.RenderEndTag(); //P

            writer.RenderBeginTag(HtmlTextWriterTag.P);
            writer.AddTag(HtmlTextWriterTag.B, "Test name: ");
            writer.Write(nunitGoTest.Name);
            writer.RenderEndTag(); //P

            writer.RenderBeginTag(HtmlTextWriterTag.P);
            writer.AddTag(HtmlTextWriterTag.B, "Test duration: ");
            writer.Write(TimeSpan.FromSeconds(nunitGoTest.TestDuration).ToString(@"hh\:mm\:ss\:fff"));
            writer.RenderEndTag(); //P

            writer.RenderBeginTag(HtmlTextWriterTag.P);
            writer.AddTag(HtmlTextWriterTag.B, "Time period: ");
            var start = nunitGoTest.DateTimeStart.ToString("dd.MM.yy HH:mm:ss.fff");
            var end = nunitGoTest.DateTimeFinish.ToString("dd.MM.yy HH:mm:ss.fff");
            writer.Write(start + " - " + end);
            writer.RenderEndTag(); //P

            writer.AddStyleAttribute(HtmlTextWriterStyle.BackgroundColor, nunitGoTest.GetColor());
            writer.RenderBeginTag(HtmlTextWriterTag.P);
            writer.RenderBeginTag(HtmlTextWriterTag.B);
            writer.Write("Test result: ");
            writer.RenderEndTag(); //B
            writer.Write(nunitGoTest.Result);
            writer.RenderEndTag(); //P

            writer.RenderEndTag(); //DIV
            return writer;
        }
Exemplo n.º 4
0
 public static HtmlTextWriter AddFailure(this HtmlTextWriter writer, NunitGoTest nunitGoTest, string id = "")
 {
     writer.AddAttribute(HtmlTextWriterAttribute.Id, id.Equals("") ? "table-cell" : id);
     writer.AddStyleAttribute(HtmlTextWriterStyle.Padding, "20px");
     writer.RenderBeginTag(HtmlTextWriterTag.Div);
     if (!nunitGoTest.IsSuccess())
     {
         writer.RenderBeginTag(HtmlTextWriterTag.P);
         writer.AddTag(HtmlTextWriterTag.B, "Message: ");
         writer.Write(NunitTestHtml.GenerateTxtView(nunitGoTest.TestMessage));
         writer.RenderEndTag(); //P
         writer.RenderBeginTag(HtmlTextWriterTag.P);
         writer.AddTag(HtmlTextWriterTag.B, "Stack trace: ");
         writer.Write(NunitTestHtml.GenerateTxtView(nunitGoTest.TestStackTrace));
         writer.RenderEndTag(); //P
     }
     else
     {
         writer.Write("Test was successful, there is no failure message");
     }
     writer.RenderEndTag();//DIV
     return writer;
 }
Exemplo n.º 5
0
 public static HtmlTextWriter AddOutput(this HtmlTextWriter writer, NunitGoTest nunitGoTest, string testOutput, string id = "")
 {
     writer.AddAttribute(HtmlTextWriterAttribute.Id, id.Equals("") ? "table-cell" : id);
     writer.AddStyleAttribute(HtmlTextWriterStyle.Padding, "20px");
     writer.RenderBeginTag(HtmlTextWriterTag.Div);
     if (nunitGoTest.HasOutput)
     {
         writer.RenderBeginTag(HtmlTextWriterTag.P);
         writer.AddTag(HtmlTextWriterTag.B, "Test output: ");
         writer.Write(NunitTestHtml.GenerateTxtView(testOutput));
         writer.RenderEndTag(); //P
     }
     else
     {
         writer.Write("Test output is empty");
     }
     writer.RenderEndTag();//DIV
     return writer;
 }
Exemplo n.º 6
0
 /// <summary>	
 /// Defines a section that is quoted from another source
 /// </summary>
 public static string blockquote(this string body, string innerHtml = null, params string[] attributes)
 {
     return body.AddTag("blockquote", innerHtml, attributes);
 }
Exemplo n.º 7
0
 /// <summary>	
 /// Used to draw graphics, on the fly, via scripting (usually JavaScript)
 /// </summary>
 public static string canvas(this string body, string innerHtml = null, params string[] attributes)
 {
     return body.AddTag("canvas", innerHtml, attributes);
 }
Exemplo n.º 8
0
 /// <summary>	
 /// Defines a multiline input control (text area)
 /// </summary>
 public static string textarea(this string body, string innerHtml = null, params string[] attributes)
 {
     return body.AddTag("textarea", innerHtml, attributes);
 }
Exemplo n.º 9
0
 /// <summary>	
 /// Defines an abbreviation or an acronym
 /// </summary>
 public static string abbr(this string body, string innerHtml = null, params string[] attributes)
 {
     return body.AddTag("abbr", innerHtml, attributes);
 }
Exemplo n.º 10
0
 /// <summary>	
 /// Defines a visible heading for a <details> element
 /// </summary>
 public static string summary(this string body, string innerHtml = null, params string[] attributes)
 {
     return body.AddTag("summary", innerHtml, attributes);
 }
Exemplo n.º 11
0
 /// <summary>	
 /// Defines a section in a document
 /// </summary>
 public static string section(this string body, string innerHtml = null, params string[] attributes)
 {
     return body.AddTag("section", innerHtml, attributes);
 }
Exemplo n.º 12
0
 /// <summary>	
 /// Add a Tag to a html string
 /// </summary>
 public static string AddTag(this string body, string tag, string innerHtml = null, params KeyValuePair<string, string>[] attributes)
 {
     return body.AddTag(tag, innerHtml, attributes.GetAttributes());
 }
Exemplo n.º 13
0
 /// <summary>	
 /// Defines the result of a calculation
 /// </summary>
 public static string output(this string body, string innerHtml = null, params string[] attributes)
 {
     return body.AddTag("output", innerHtml, attributes);
 }
Exemplo n.º 14
0
 /// <summary>	
 /// Defines a command menu item that the user can invoke from a popup menu
 /// </summary>
 public static string menuitem(this string body, string innerHtml = null, params string[] attributes)
 {
     return body.AddTag("menuitem", innerHtml, attributes);
 }
Exemplo n.º 15
0
 /// <summary>	
 /// Defines an alternate content for users that do not support client-side scripts
 /// </summary>
 public static string noscript(this string body, string innerHtml = null, params string[] attributes)
 {
     return body.AddTag("noscript", innerHtml, attributes);
 }
Exemplo n.º 16
0
 /// <summary>	
 /// Defines a caption for a <fieldset> element
 /// </summary>
 public static string legend(this string body, string innerHtml = null, params string[] attributes)
 {
     return body.AddTag("legend", innerHtml, attributes);
 }
Exemplo n.º 17
0
 /// <summary>	
 /// Specifies self-contained content
 /// </summary>
 public static string figure(this string body, string innerHtml = null, params string[] attributes)
 {
     return body.AddTag("figure", innerHtml, attributes);
 }
Exemplo n.º 18
0
 /// <summary>	
 /// Defines a dialog box or window
 /// </summary>
 public static string dialog(this string body, string innerHtml = null, params string[] attributes)
 {
     return body.AddTag("dialog", innerHtml, attributes);
 }
Exemplo n.º 19
0
		/// <summary>
		/// Add a tag or branch to a FileInfo.
		/// </summary>
		public static FileInfo WithTag(this FileInfo file, string tagName, string revision)
		{
			file.AddTag(tagName, revision);
			return file;
		}
Exemplo n.º 20
0
 /// <summary>	
 /// Represents the progress of a task
 /// </summary>
 public static string progress(this string body, string innerHtml = null, params string[] attributes)
 {
     return body.AddTag("progress", innerHtml, attributes);
 }
Exemplo n.º 21
0
 /// <summary>	
 /// Defines a group of related options in a drop-down list
 /// </summary>
 public static string optgroup(this string body, string innerHtml = null, params string[] attributes)
 {
     return body.AddTag("optgroup", innerHtml, attributes);
 }
Exemplo n.º 22
0
 /// <summary>	
 /// Specifies a list of pre-defined options for input controls
 /// </summary>
 public static string datalist(this string body, string innerHtml = null, params string[] attributes)
 {
     return body.AddTag("datalist", innerHtml, attributes);
 }