[NUI] Rebase develnui (DevelNUI only patches --> master) (#3910)
[platform/core/csapi/tizenfx.git] / test / Tizen.NUI.Devel.Tests.Ubuntu / nunit.framework / Constraints / MessageWriter.cs
1 // ***********************************************************************
2 // Copyright (c) 2007 Charlie Poole
3 //
4 // Permission is hereby granted, free of charge, to any person obtaining
5 // a copy of this software and associated documentation files (the
6 // "Software"), to deal in the Software without restriction, including
7 // without limitation the rights to use, copy, modify, merge, publish,
8 // distribute, sublicense, and/or sell copies of the Software, and to
9 // permit persons to whom the Software is furnished to do so, subject to
10 // the following conditions:
11 // 
12 // The above copyright notice and this permission notice shall be
13 // included in all copies or substantial portions of the Software.
14 // 
15 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
19 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
20 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
21 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22 // ***********************************************************************
23 #define PORTABLE
24 #define TIZEN
25 #define NUNIT_FRAMEWORK
26 #define NUNITLITE
27 #define NET_4_5
28 #define PARALLEL
29 using System.IO;
30 using System.Collections;
31
32 namespace NUnit.Framework.Constraints
33 {
34     /// <summary>
35     /// MessageWriter is the abstract base for classes that write
36     /// constraint descriptions and messages in some form. The
37     /// class has separate methods for writing various components
38     /// of a message, allowing implementations to tailor the
39     /// presentation as needed.
40     /// </summary>
41     public abstract class MessageWriter : StringWriter
42     {
43
44         /// <summary>
45         /// Construct a MessageWriter given a culture
46         /// </summary>
47         protected MessageWriter() : base(System.Globalization.CultureInfo.InvariantCulture) { }
48
49         /// <summary>
50         /// Abstract method to get the max line length
51         /// </summary>
52         public abstract int MaxLineLength { get; set; }
53
54         /// <summary>
55         /// Method to write single line  message with optional args, usually
56         /// written to precede the general failure message.
57         /// </summary>
58         /// <param name="message">The message to be written</param>
59         /// <param name="args">Any arguments used in formatting the message</param>
60         public void WriteMessageLine(string message, params object[] args)
61         {
62             WriteMessageLine(0, message, args);
63         }
64
65         /// <summary>
66         /// Method to write single line  message with optional args, usually
67         /// written to precede the general failure message, at a givel 
68         /// indentation level.
69         /// </summary>
70         /// <param name="level">The indentation level of the message</param>
71         /// <param name="message">The message to be written</param>
72         /// <param name="args">Any arguments used in formatting the message</param>
73         public abstract void WriteMessageLine(int level, string message, params object[] args);
74
75         /// <summary>
76         /// Display Expected and Actual lines for a constraint. This
77         /// is called by MessageWriter's default implementation of 
78         /// WriteMessageTo and provides the generic two-line display. 
79         /// </summary>
80         /// <param name="result">The failing constraint result</param>
81         public abstract void DisplayDifferences(ConstraintResult result);
82
83         /// <summary>
84         /// Display Expected and Actual lines for given _values. This
85         /// method may be called by constraints that need more control over
86         /// the display of actual and expected _values than is provided
87         /// by the default implementation.
88         /// </summary>
89         /// <param name="expected">The expected value</param>
90         /// <param name="actual">The actual value causing the failure</param>
91         public abstract void DisplayDifferences(object expected, object actual);
92
93         /// <summary>
94         /// Display Expected and Actual lines for given _values, including
95         /// a tolerance value on the Expected line.
96         /// </summary>
97         /// <param name="expected">The expected value</param>
98         /// <param name="actual">The actual value causing the failure</param>
99         /// <param name="tolerance">The tolerance within which the test was made</param>
100         public abstract void DisplayDifferences(object expected, object actual, Tolerance tolerance);
101
102         /// <summary>
103         /// Display the expected and actual string _values on separate lines.
104         /// If the mismatch parameter is >=0, an additional line is displayed
105         /// line containing a caret that points to the mismatch point.
106         /// </summary>
107         /// <param name="expected">The expected string value</param>
108         /// <param name="actual">The actual string value</param>
109         /// <param name="mismatch">The point at which the strings don't match or -1</param>
110         /// <param name="ignoreCase">If true, case is ignored in locating the point where the strings differ</param>
111         /// <param name="clipping">If true, the strings should be clipped to fit the line</param>
112         public abstract void DisplayStringDifferences(string expected, string actual, int mismatch, bool ignoreCase, bool clipping);
113
114         /// <summary>
115         /// Writes the text for an actual value.
116         /// </summary>
117         /// <param name="actual">The actual value.</param>
118         public abstract void WriteActualValue(object actual);
119
120         /// <summary>
121         /// Writes the text for a generalized value.
122         /// </summary>
123         /// <param name="val">The value.</param>
124         public abstract void WriteValue(object val);
125
126         /// <summary>
127         /// Writes the text for a collection value,
128         /// starting at a particular point, to a max length
129         /// </summary>
130         /// <param name="collection">The collection containing elements to write.</param>
131         /// <param name="start">The starting point of the elements to write</param>
132         /// <param name="max">The maximum number of elements to write</param>
133         public abstract void WriteCollectionElements(IEnumerable collection, long start, int max);
134     }
135 }