[NUI] Rebase develnui (DevelNUI only patches --> master) (#3910)
[platform/core/csapi/tizenfx.git] / test / Tizen.NUI.Devel.Tests.Ubuntu / nunit.framework / Has.cs
1 // ***********************************************************************
2 // Copyright (c) 2009 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;
30 using System.Collections;
31 using NUnit.Framework.Constraints;
32
33 namespace NUnit.Framework
34 {
35     /// <summary>
36     /// Helper class with properties and methods that supply
37     /// a number of constraints used in Asserts.
38     /// </summary>
39     public class Has
40     {
41         #region No
42
43         /// <summary>
44         /// Returns a ConstraintExpression that negates any
45         /// following constraint.
46         /// </summary>
47         public static ConstraintExpression No
48         {
49             get { return new ConstraintExpression().Not; }
50         }
51
52         #endregion
53
54         #region All
55
56         /// <summary>
57         /// Returns a ConstraintExpression, which will apply
58         /// the following constraint to all members of a collection,
59         /// succeeding if all of them succeed.
60         /// </summary>
61         public static ConstraintExpression All
62         {
63             get { return new ConstraintExpression().All; }
64         }
65
66         #endregion
67
68         #region Some
69
70         /// <summary>
71         /// Returns a ConstraintExpression, which will apply
72         /// the following constraint to all members of a collection,
73         /// succeeding if at least one of them succeeds.
74         /// </summary>
75         public static ConstraintExpression Some
76         {
77             get { return new ConstraintExpression().Some; }
78         }
79
80         #endregion
81
82         #region None
83
84         /// <summary>
85         /// Returns a ConstraintExpression, which will apply
86         /// the following constraint to all members of a collection,
87         /// succeeding if all of them fail.
88         /// </summary>
89         public static ConstraintExpression None
90         {
91             get { return new ConstraintExpression().None; }
92         }
93
94         #endregion
95
96         #region Exactly(n)
97  
98         /// <summary>
99         /// Returns a ConstraintExpression, which will apply
100         /// the following constraint to all members of a collection,
101         /// succeeding only if a specified number of them succeed.
102         /// </summary>
103         public static ConstraintExpression Exactly(int expectedCount)
104         {
105             return new ConstraintExpression().Exactly(expectedCount);
106         }
107  
108         #endregion
109
110         #region Property
111
112         /// <summary>
113         /// Returns a new PropertyConstraintExpression, which will either
114         /// test for the existence of the named property on the object
115         /// being tested or apply any following constraint to that property.
116         /// </summary>
117         public static ResolvableConstraintExpression Property(string name)
118         {
119             return new ConstraintExpression().Property(name);
120         }
121
122         #endregion
123
124         #region Length
125
126         /// <summary>
127         /// Returns a new ConstraintExpression, which will apply the following
128         /// constraint to the Length property of the object being tested.
129         /// </summary>
130         public static ResolvableConstraintExpression Length
131         {
132             get { return Property("Length"); }
133         }
134
135         #endregion
136
137         #region Count
138
139         /// <summary>
140         /// Returns a new ConstraintExpression, which will apply the following
141         /// constraint to the Count property of the object being tested.
142         /// </summary>
143         public static ResolvableConstraintExpression Count
144         {
145             get { return Property("Count"); }
146         }
147
148         #endregion
149
150         #region Message
151
152         /// <summary>
153         /// Returns a new ConstraintExpression, which will apply the following
154         /// constraint to the Message property of the object being tested.
155         /// </summary>
156         public static ResolvableConstraintExpression Message
157         {
158             get { return Property("Message"); }
159         }
160
161         #endregion
162
163         #region InnerException
164
165         /// <summary>
166         /// Returns a new ConstraintExpression, which will apply the following
167         /// constraint to the InnerException property of the object being tested.
168         /// </summary>
169         public static ResolvableConstraintExpression InnerException
170         {
171             get { return Property("InnerException"); }
172         }
173
174         #endregion
175
176         #region Attribute
177         
178         /// <summary>
179         /// Returns a new AttributeConstraint checking for the
180         /// presence of a particular attribute on an object.
181         /// </summary>
182         public static ResolvableConstraintExpression Attribute(Type expectedType)
183         {
184             return new ConstraintExpression().Attribute(expectedType);
185         }
186
187         /// <summary>
188         /// Returns a new AttributeConstraint checking for the
189         /// presence of a particular attribute on an object.
190         /// </summary>
191         public static ResolvableConstraintExpression Attribute<T>()
192         {
193             return Attribute(typeof(T));
194         }
195
196         #endregion
197
198         #region Member
199
200         /// <summary>
201         /// Returns a new CollectionContainsConstraint checking for the
202         /// presence of a particular object in the collection.
203         /// </summary>
204         public static CollectionContainsConstraint Member(object expected)
205         {
206             return new CollectionContainsConstraint(expected);
207         }
208
209         #endregion
210
211     }
212 }