Merge pull request #1336 from esdrubal/datatablereadxmlschema
[mono.git] / mcs / nunit24 / NUnitFramework / framework / MessageWriter.cs
1 // ****************************************************************\r
2 // Copyright 2007, Charlie Poole\r
3 // This is free software licensed under the NUnit license. You may\r
4 // obtain a copy of the license at http://nunit.org/?p=license&r=2.4\r
5 // ****************************************************************\r
6 \r
7 using System;\r
8 using System.IO;\r
9 using System.Collections;\r
10 using NUnit.Framework.Constraints;\r
11 \r
12 namespace NUnit.Framework\r
13 {\r
14         /// <summary>\r
15         /// MessageWriter is the abstract base for classes that write\r
16         /// constraint descriptions and messages in some form. The\r
17         /// class has separate methods for writing various components\r
18         /// of a message, allowing implementations to tailor the\r
19         /// presentation as needed.\r
20         /// </summary>\r
21     public abstract class MessageWriter : StringWriter\r
22     {\r
23 \r
24                 /// <summary>\r
25                 /// Construct a MessageWriter given a culture\r
26                 /// </summary>\r
27         public MessageWriter() : base( System.Globalization.CultureInfo.InvariantCulture ) { }\r
28 \r
29         /// <summary>\r
30         /// Abstract method to get the max line length\r
31         /// </summary>\r
32         public abstract int MaxLineLength { get; set; }\r
33 \r
34                 /// <summary>\r
35                 /// Method to write single line  message with optional args, usually\r
36                 /// written to precede the general failure message.\r
37                 /// </summary>\r
38                 /// <param name="message">The message to be written</param>\r
39                 /// <param name="args">Any arguments used in formatting the message</param>\r
40                 public void WriteMessageLine(string message, params object[] args)\r
41         {\r
42             WriteMessageLine(0, message, args);\r
43         }\r
44 \r
45         /// <summary>\r
46         /// Method to write single line  message with optional args, usually\r
47         /// written to precede the general failure message, at a givel \r
48         /// indentation level.\r
49         /// </summary>\r
50         /// <param name="level">The indentation level of the message</param>\r
51         /// <param name="message">The message to be written</param>\r
52         /// <param name="args">Any arguments used in formatting the message</param>\r
53         public abstract void WriteMessageLine(int level, string message, params object[] args);\r
54 \r
55         /// <summary>\r
56         /// Display Expected and Actual lines for a constraint. This\r
57         /// is called by MessageWriter's default implementation of \r
58         /// WriteMessageTo and provides the generic two-line display. \r
59         /// </summary>\r
60         /// <param name="constraint">The constraint that failed</param>\r
61         public abstract void DisplayDifferences(Constraint constraint);\r
62 \r
63                 /// <summary>\r
64                 /// Display Expected and Actual lines for given values. This\r
65                 /// method may be called by constraints that need more control over\r
66                 /// the display of actual and expected values than is provided\r
67                 /// by the default implementation.\r
68                 /// </summary>\r
69                 /// <param name="expected">The expected value</param>\r
70                 /// <param name="actual">The actual value causing the failure</param>\r
71                 public abstract void DisplayDifferences(object expected, object actual);\r
72 \r
73                 /// <summary>\r
74                 /// Display Expected and Actual lines for given values, including\r
75                 /// a tolerance value on the Expected line.\r
76                 /// </summary>\r
77                 /// <param name="expected">The expected value</param>\r
78                 /// <param name="actual">The actual value causing the failure</param>\r
79                 /// <param name="tolerance">The tolerance within which the test was made</param>\r
80                 public abstract void DisplayDifferences(object expected, object actual, object tolerance);\r
81 \r
82                 /// <summary>\r
83         /// Display the expected and actual string values on separate lines.\r
84         /// If the mismatch parameter is >=0, an additional line is displayed\r
85         /// line containing a caret that points to the mismatch point.\r
86         /// </summary>\r
87         /// <param name="expected">The expected string value</param>\r
88         /// <param name="actual">The actual string value</param>\r
89         /// <param name="mismatch">The point at which the strings don't match or -1</param>\r
90         /// <param name="ignoreCase">If true, case is ignored in locating the point where the strings differ</param>\r
91         /// <param name="clipping">If true, the strings should be clipped to fit the line</param>\r
92         public abstract void DisplayStringDifferences(string expected, string actual, int mismatch, bool ignoreCase, bool clipping);\r
93 \r
94         /// <summary>\r
95         /// Writes the text for a connector.\r
96         /// </summary>\r
97         /// <param name="connector">The connector.</param>\r
98         public abstract void WriteConnector(string connector);\r
99 \r
100         /// <summary>\r
101         /// Writes the text for a predicate.\r
102         /// </summary>\r
103         /// <param name="predicate">The predicate.</param>\r
104         public abstract void WritePredicate(string predicate);\r
105 \r
106                 /// <summary>\r
107                 /// Writes the text for an expected value.\r
108                 /// </summary>\r
109                 /// <param name="expected">The expected value.</param>\r
110                 public abstract void WriteExpectedValue(object expected);\r
111 \r
112                 /// <summary>\r
113                 /// Writes the text for a modifier\r
114                 /// </summary>\r
115                 /// <param name="modifier">The modifier.</param>\r
116                 public abstract void WriteModifier(string modifier);\r
117 \r
118                 /// <summary>\r
119                 /// Writes the text for an actual value.\r
120                 /// </summary>\r
121                 /// <param name="actual">The actual value.</param>\r
122                 public abstract void WriteActualValue(object actual);\r
123 \r
124                 /// <summary>\r
125                 /// Writes the text for a generalized value.\r
126                 /// </summary>\r
127                 /// <param name="val">The value.</param>\r
128                 public abstract void WriteValue(object val);\r
129     \r
130                 /// <summary>\r
131                 /// Writes the text for a collection value,\r
132                 /// starting at a particular point, to a max length\r
133                 /// </summary>\r
134                 /// <param name="collection">The collection containing elements to write.</param>\r
135         /// <param name="start">The starting point of the elements to write</param>\r
136         /// <param name="max">The maximum number of elements to write</param>\r
137                 public abstract void WriteCollectionElements(ICollection collection, int start, int max);\r
138         }\r
139 }\r