PageRenderTime 27ms CodeModel.GetById 0ms RepoModel.GetById 1ms app.codeStats 0ms

/src/NUnit/interfaces/TestOutput.cs

#
C# | 92 lines | 40 code | 9 blank | 43 comment | 0 complexity | 01cc873f6938786b105d604a37bfaf25 MD5 | raw file
Possible License(s): GPL-2.0
  1. // ****************************************************************
  2. // Copyright 2007, Charlie Poole
  3. // This is free software licensed under the NUnit license. You may
  4. // obtain a copy of the license at http://nunit.org
  5. // ****************************************************************
  6. namespace NUnit.Core
  7. {
  8. using System;
  9. /// <summary>
  10. /// The TestOutput class holds a unit of output from
  11. /// a test to either stdOut or stdErr
  12. /// </summary>
  13. [Serializable]
  14. public class TestOutput
  15. {
  16. string text;
  17. TestOutputType type;
  18. /// <summary>
  19. /// Construct with text and an ouput destination type
  20. /// </summary>
  21. /// <param name="text">Text to be output</param>
  22. /// <param name="type">Destination of output</param>
  23. public TestOutput(string text, TestOutputType type)
  24. {
  25. this.text = text;
  26. this.type = type;
  27. }
  28. /// <summary>
  29. /// Return string representation of the object for debugging
  30. /// </summary>
  31. /// <returns></returns>
  32. public override string ToString()
  33. {
  34. return type + ": " + text;
  35. }
  36. /// <summary>
  37. /// Get the text
  38. /// </summary>
  39. public string Text
  40. {
  41. get
  42. {
  43. return this.text;
  44. }
  45. }
  46. /// <summary>
  47. /// Get the output type
  48. /// </summary>
  49. public TestOutputType Type
  50. {
  51. get
  52. {
  53. return this.type;
  54. }
  55. }
  56. }
  57. /// <summary>
  58. /// Enum representing the output destination
  59. /// It uses combinable flags so that a given
  60. /// output control can accept multiple types
  61. /// of output. Normally, each individual
  62. /// output uses a single flag value.
  63. /// </summary>
  64. public enum TestOutputType
  65. {
  66. /// <summary>
  67. /// Send output to stdOut
  68. /// </summary>
  69. Out,
  70. /// <summary>
  71. /// Send output to stdErr
  72. /// </summary>
  73. Error,
  74. /// <summary>
  75. /// Send output to Trace
  76. /// </summary>
  77. Trace,
  78. /// <summary>
  79. /// Send output to Log
  80. /// </summary>
  81. Log
  82. }
  83. }