1 | <!-- saved from url=(0014)about:internet --><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
|
---|
2 | <html>
|
---|
3 | <!-- Standard Head Part -->
|
---|
4 | <head>
|
---|
5 | <title>NUnit - PropertyConstraint</title>
|
---|
6 | <meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
|
---|
7 | <meta http-equiv="Content-Language" content="en-US">
|
---|
8 | <link rel="stylesheet" type="text/css" href="nunit.css">
|
---|
9 | <link rel="shortcut icon" href="favicon.ico">
|
---|
10 | </head>
|
---|
11 | <!-- End Standard Head Part -->
|
---|
12 |
|
---|
13 | <body>
|
---|
14 |
|
---|
15 | <!-- Standard Header for NUnit.org -->
|
---|
16 | <div id="header">
|
---|
17 | <a id="logo" href="http://www.nunit.org"><img src="img/logo.gif" alt="NUnit.org" title="NUnit.org"></a>
|
---|
18 | <div id="nav">
|
---|
19 | <a href="http://www.nunit.org">NUnit</a>
|
---|
20 | <a class="active" href="index.html">Documentation</a>
|
---|
21 | </div>
|
---|
22 | </div>
|
---|
23 | <!-- End of Header -->
|
---|
24 |
|
---|
25 | <div id="content">
|
---|
26 |
|
---|
27 | <h2>Property Constraints (NUnit 2.4.2)</h2>
|
---|
28 |
|
---|
29 | <p>Property constraints are used to test for the existence of a named property and
|
---|
30 | optionally to test its value. It may also be used as a prefix for other constraints
|
---|
31 | to be applied to the property.
|
---|
32 |
|
---|
33 | <h3>PropertyExistsConstraint</h3>
|
---|
34 |
|
---|
35 | <h4>Action</h4>
|
---|
36 |
|
---|
37 | <p>Tests for the existence of a named property on an object.
|
---|
38 |
|
---|
39 | <h4>Constructor</h4>
|
---|
40 |
|
---|
41 | <div class="code"><pre>
|
---|
42 | PropertyExistsConstraint(string name)
|
---|
43 | </pre></div>
|
---|
44 |
|
---|
45 | <h4>Syntax</h4>
|
---|
46 |
|
---|
47 | <div class="code"><pre>
|
---|
48 | Has.Property( string )
|
---|
49 | </pre></div>
|
---|
50 |
|
---|
51 | <h4>Examples of Use</h4>
|
---|
52 |
|
---|
53 | <div class="code"><pre>
|
---|
54 | Assert.That( someObject, Has.Property( "Version" ) );
|
---|
55 | </pre></div>
|
---|
56 |
|
---|
57 | <h3>PropertyConstraint</h3>
|
---|
58 |
|
---|
59 | <h4>Action</h4>
|
---|
60 |
|
---|
61 | <p>Tests for the existence of a named property on an object and causes subsequent
|
---|
62 | allows tests to be made on the property value.
|
---|
63 |
|
---|
64 | <h4>Constructor</h4>
|
---|
65 |
|
---|
66 | <div class="code"><pre>
|
---|
67 | PropertyConstraint(string name)
|
---|
68 | </pre></div>
|
---|
69 |
|
---|
70 | <h4>Syntax</h4>
|
---|
71 |
|
---|
72 | <div class="code"><pre>
|
---|
73 | Has.Property(string)...
|
---|
74 | </pre></div>
|
---|
75 |
|
---|
76 | <h4>Examples of Use</h4>
|
---|
77 |
|
---|
78 | <div class="code"><pre>
|
---|
79 | Assert.That(someObject, Has.Property("Version").EqualTo("2.0"));
|
---|
80 | Assert.That(collection, Has.Property("Count").GreaterThan(10));
|
---|
81 | </pre></div>
|
---|
82 |
|
---|
83 | <h3>Special Properties</h3>
|
---|
84 |
|
---|
85 | <p>Certain common properties are known to NUnit and
|
---|
86 | may be tested using the following syntax...
|
---|
87 |
|
---|
88 | <div class="code"><pre>
|
---|
89 | Has.Length...
|
---|
90 | Has.Count...
|
---|
91 | Has.Message...
|
---|
92 | Has.InnerException...
|
---|
93 | </pre></div>
|
---|
94 |
|
---|
95 |
|
---|
96 | </div>
|
---|
97 |
|
---|
98 | <!-- Submenu -->
|
---|
99 | <div id="subnav">
|
---|
100 | <ul>
|
---|
101 | <li><a href="index.html">NUnit 2.5.10</a></li>
|
---|
102 | <ul>
|
---|
103 | <li><a href="getStarted.html">Getting Started</a></li>
|
---|
104 | <li><a href="assertions.html">Assertions</a></li>
|
---|
105 | <li><a href="constraintModel.html">Constraints</a></li>
|
---|
106 | <ul>
|
---|
107 | <li><a href="equalConstraint.html">Equal Constraint</a></li>
|
---|
108 | <li><a href="sameasConstraint.html">SameAs Constraint</a></li>
|
---|
109 | <li><a href="conditionConstraints.html">Condition Constraints</a></li>
|
---|
110 | <li><a href="comparisonConstraints.html">Comparison Constrants</a></li>
|
---|
111 | <li><a href="pathConstraints.html">Path Constraints</a></li>
|
---|
112 | <li><a href="typeConstraints.html">Type Constraints</a></li>
|
---|
113 | <li><a href="stringConstraints.html">String Constraints</a></li>
|
---|
114 | <li><a href="collectionConstraints.html">Collection Constraints</a></li>
|
---|
115 | <li id="current"><a href="propertyConstraint.html">Property Constraint</a></li>
|
---|
116 | <li><a href="throwsConstraint.html">Throws Constraint</a></li>
|
---|
117 | <li><a href="compoundConstraints.html">Compound Constraints</a></li>
|
---|
118 | <li><a href="delayedConstraint.html">Delayed Constraint</a></li>
|
---|
119 | <li><a href="listMapper.html">List Mapper</a></li>
|
---|
120 | <li><a href="reusableConstraint.html">Reusable Constraint</a></li>
|
---|
121 | </ul>
|
---|
122 | <li><a href="attributes.html">Attributes</a></li>
|
---|
123 | <li><a href="runningTests.html">Running Tests</a></li>
|
---|
124 | <li><a href="extensibility.html">Extensibility</a></li>
|
---|
125 | <li><a href="releaseNotes.html">Release Notes</a></li>
|
---|
126 | <li><a href="samples.html">Samples</a></li>
|
---|
127 | <li><a href="license.html">License</a></li>
|
---|
128 | </ul>
|
---|
129 | </ul>
|
---|
130 | </div>
|
---|
131 | <!-- End of Submenu -->
|
---|
132 |
|
---|
133 |
|
---|
134 | <!-- Standard Footer for NUnit.org -->
|
---|
135 | <div id="footer">
|
---|
136 | Copyright © 2010 Charlie Poole. All Rights Reserved.
|
---|
137 | </div>
|
---|
138 | <!-- End of Footer -->
|
---|
139 |
|
---|
140 | </body>
|
---|
141 | </html>
|
---|