Merge pull request #1336 from esdrubal/datatablereadxmlschema
[mono.git] / mcs / nunit24 / NUnitFramework / framework / SyntaxHelpers / Text.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 NUnit.Framework.Constraints;\r
9 \r
10 namespace NUnit.Framework.SyntaxHelpers\r
11 {\r
12         /// <summary>\r
13         /// The Text class is a helper class with properties and methods\r
14         /// that supply a number of constraints used with strings.\r
15         /// </summary>\r
16         public class Text\r
17         {\r
18                 /// <summary>\r
19                 /// Text.All returns a ConstraintBuilder, which will apply\r
20                 /// the following constraint to all members of a collection,\r
21                 /// succeeding if all of them succeed.\r
22                 /// </summary>\r
23                 public static ConstraintBuilder All\r
24                 {\r
25                         get { return new ConstraintBuilder().All; }\r
26                 }\r
27 \r
28                 /// <summary>\r
29                 /// Contains returns a constraint that succeeds if the actual\r
30                 /// value contains the substring supplied as an argument.\r
31                 /// </summary>\r
32                 public static Constraint Contains(string substring)\r
33                 {\r
34                         return new SubstringConstraint(substring);\r
35                 }\r
36 \r
37                 /// <summary>\r
38                 /// DoesNotContain returns a constraint that fails if the actual\r
39                 /// value contains the substring supplied as an argument.\r
40                 /// </summary>\r
41                 public static Constraint DoesNotContain(string substring)\r
42                 {\r
43                         return new NotConstraint( Contains(substring) );\r
44                 }\r
45 \r
46                 /// <summary>\r
47                 /// StartsWith returns a constraint that succeeds if the actual\r
48                 /// value starts with the substring supplied as an argument.\r
49                 /// </summary>\r
50                 public static Constraint StartsWith(string substring)\r
51                 {\r
52                         return new StartsWithConstraint(substring);\r
53                 }\r
54 \r
55                 /// <summary>\r
56                 /// DoesNotStartWith returns a constraint that fails if the actual\r
57                 /// value starts with the substring supplied as an argument.\r
58                 /// </summary>\r
59                 public static Constraint DoesNotStartWith(string substring)\r
60                 {\r
61                         return new NotConstraint( StartsWith(substring) );\r
62                 }\r
63 \r
64                 /// <summary>\r
65                 /// EndsWith returns a constraint that succeeds if the actual\r
66                 /// value ends with the substring supplied as an argument.\r
67                 /// </summary>\r
68                 public static Constraint EndsWith(string substring)\r
69                 {\r
70                         return new EndsWithConstraint(substring);\r
71                 }\r
72 \r
73                 /// <summary>\r
74                 /// DoesNotEndWith returns a constraint that fails if the actual\r
75                 /// value ends with the substring supplied as an argument.\r
76                 /// </summary>\r
77                 public static Constraint DoesNotEndWith(string substring)\r
78                 {\r
79                         return new NotConstraint( EndsWith(substring) );\r
80                 }\r
81 \r
82                 /// <summary>\r
83                 /// Matches returns a constraint that succeeds if the actual\r
84                 /// value matches the pattern supplied as an argument.\r
85                 /// </summary>\r
86                 /// <param name="pattern"></param>\r
87                 /// <returns></returns>\r
88                 public static Constraint Matches(string pattern)\r
89                 {\r
90                         return new RegexConstraint(pattern);\r
91                 }\r
92 \r
93                 /// <summary>\r
94                 /// DoesNotMatch returns a constraint that failss if the actual\r
95                 /// value matches the pattern supplied as an argument.\r
96                 /// </summary>\r
97                 /// <param name="pattern"></param>\r
98                 /// <returns></returns>\r
99                 public static Constraint DoesNotMatch(string pattern)\r
100                 {\r
101                         return new NotConstraint( Matches(pattern) );\r
102                 }\r
103         }\r
104 }\r