/// <summary>
 /// Called when a test produces output for immediate display
 /// </summary>
 /// <param name="output">A TestOutput object containing the text to display</param>
 public void TestOutput(TestOutput output)
 {
     try
     {
         handler.RaiseCallbackEvent(output.ToXml());
     }
     catch (Exception ex)
     {
         log.Error("Exception processing TestOutput event" + NUnit.Env.NewLine + ex.ToString());
     }
 }
Exemple #2
0
        /// <summary>
        /// Called when the test creates text output.
        /// </summary>
        /// <param name="testOutput">A console message</param>
        public void TestOutput(TestOutput testOutput)
        {
            try
            {
#if false
                string report = string.Format("<output type=\"{0}\"><text>{1}</text></output>",
                                              testOutput.Type, testOutput.Text);

                handler.RaiseCallbackEvent(report);
#else
                handler.RaiseCallbackEvent(testOutput.ToXml(false).OuterXml);
#endif
            }
            catch (Exception ex)
            {
                log.Error("Exception processing: " + testOutput.ToString() + NUnit.Env.NewLine + ex.ToString());
            }
        }
Exemple #3
0
        public void ToXml_IncludeAttributesInProperFormatting(string text, string stream, string testId, string testName)
        {
            var testOutput = new TestOutput(text, stream, testId, testName);
            var expected   = new StringBuilder();

            expected.AppendFormat("<test-output stream=\"{0}\"", stream);

            if (testId != null)
            {
                expected.AppendFormat(" testid=\"{0}\"", testId);
            }

            if (testName != null)
            {
                expected.AppendFormat(" testname=\"{0}\"", testName);
            }

            expected.AppendFormat("><![CDATA[{0}]]></test-output>", text);
            Assert.That(testOutput.ToXml(), Is.EqualTo(expected.ToString()));
        }