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 - Datapoint</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 | <h3>DatapointAttribute / DatapointsAttribute (NUnit 2.5) (Experimental)</h3>
|
---|
28 |
|
---|
29 | <p>The <b>Datapoint</b> and <b>Datapoints</b> attributes are used
|
---|
30 | to provide data for <b>Theories</b> and are ignored for ordinary
|
---|
31 | tests - including tests with parameters.
|
---|
32 |
|
---|
33 | <h4>DataPointAttribute</h4>
|
---|
34 |
|
---|
35 | <p>When a Theory is loaded, NUnit creates arguments for each
|
---|
36 | of its parameters by using any fields of the same type
|
---|
37 | as the parameter annotated with the <b>DatapointAttribute</b>.
|
---|
38 | Fields must be members of the class containing the Theory
|
---|
39 | and their Type must exactly match the argument for which
|
---|
40 | data is being supplied.
|
---|
41 |
|
---|
42 | <h4>DataPointsAttribute</h4>
|
---|
43 |
|
---|
44 | <p>In addition to specifying individual datapoints, collections of
|
---|
45 | datapoints may be provided by use of the <b>DatapointsAttribute</b>
|
---|
46 | - note the spelling. This attribute may be placed on methods or
|
---|
47 | properties in addition to fields. The returned value must be
|
---|
48 | either an array of the required type or (beginning with NUnit
|
---|
49 | 2.5.5) an <b>IEnumerable<T></b> returning an enumeration
|
---|
50 | of the required type. The data Type must exactly match the argument
|
---|
51 | for which data is being supplied.
|
---|
52 |
|
---|
53 | <h4>Automatically Supplied Datapoints</h4>
|
---|
54 |
|
---|
55 | <p>It is normally not necessary to specify datapoints for
|
---|
56 | <b>boolean</b> or <b>enum</b> arguments. Beginning with
|
---|
57 | version 2.5.4, NUnit automatically supplies values of <b>true</b>
|
---|
58 | and <b>false</b> for <b>boolean</b> arguments and will supply all
|
---|
59 | defined values of any enumeration.
|
---|
60 |
|
---|
61 | <p>If for some reason you don't wish to use all possible values, you
|
---|
62 | can override this behavior by supplying your own datapoints. If you
|
---|
63 | supply any datapoints for an argument, automatic datapoint generation
|
---|
64 | is suppressed.
|
---|
65 |
|
---|
66 | <h4>Example</h4>
|
---|
67 |
|
---|
68 | <p>For an example of use, see <a href="theory.html">TheoryAttribute</a>.
|
---|
69 |
|
---|
70 | <h4>See also...</h4>
|
---|
71 |
|
---|
72 | <ul>
|
---|
73 | <li><a href="theory.html">TheoryAttribute</a><li><a href="parameterizedTests.html">Parameterized Tests</a></ul>
|
---|
74 |
|
---|
75 |
|
---|
76 | </div>
|
---|
77 |
|
---|
78 | <!-- Submenu -->
|
---|
79 | <div id="subnav">
|
---|
80 | <ul>
|
---|
81 | <li><a href="index.html">NUnit 2.5.10</a></li>
|
---|
82 | <ul>
|
---|
83 | <li><a href="getStarted.html">Getting Started</a></li>
|
---|
84 | <li><a href="assertions.html">Assertions</a></li>
|
---|
85 | <li><a href="constraintModel.html">Constraints</a></li>
|
---|
86 | <li><a href="attributes.html">Attributes</a></li>
|
---|
87 | <ul>
|
---|
88 | <li><a href="category.html">Category</a></li>
|
---|
89 | <li><a href="combinatorial.html">Combinatorial</a></li>
|
---|
90 | <li><a href="culture.html">Culture</a></li>
|
---|
91 | <li id="current"><a href="datapoint.html">Datapoint(s)</a></li>
|
---|
92 | <li><a href="description.html">Description</a></li>
|
---|
93 | <li><a href="exception.html">Exception</a></li>
|
---|
94 | <li><a href="explicit.html">Explicit</a></li>
|
---|
95 | <li><a href="ignore.html">Ignore</a></li>
|
---|
96 | <li><a href="maxtime.html">Maxtime</a></li>
|
---|
97 | <li><a href="pairwise.html">Pairwise</a></li>
|
---|
98 | <li><a href="platform.html">Platform</a></li>
|
---|
99 | <li><a href="property.html">Property</a></li>
|
---|
100 | <li><a href="random.html">Random</a></li>
|
---|
101 | <li><a href="range.html">Range</a></li>
|
---|
102 | <li><a href="repeat.html">Repeat</a></li>
|
---|
103 | <li><a href="requiredAddin.html">RequiredAddin</a></li>
|
---|
104 | <li><a href="requiresMTA.html">Requires MTA</a></li>
|
---|
105 | <li><a href="requiresSTA.html">Requires STA</a></li>
|
---|
106 | <li><a href="requiresThread.html">Requires Thread</a></li>
|
---|
107 | <li><a href="sequential.html">Sequential</a></li>
|
---|
108 | <li><a href="setCulture.html">SetCulture</a></li>
|
---|
109 | <li><a href="setUICulture.html">SetUICulture</a></li>
|
---|
110 | <li><a href="setup.html">Setup</a></li>
|
---|
111 | <li><a href="setupFixture.html">SetupFixture</a></li>
|
---|
112 | <li><a href="suite.html">Suite</a></li>
|
---|
113 | <li><a href="teardown.html">Teardown</a></li>
|
---|
114 | <li><a href="test.html">Test</a></li>
|
---|
115 | <li><a href="testCase.html">TestCase</a></li>
|
---|
116 | <li><a href="testCaseSource.html">TestCaseSource</a></li>
|
---|
117 | <li><a href="testFixture.html">TestFixture</a></li>
|
---|
118 | <li><a href="fixtureSetup.html">TestFixtureSetUp</a></li>
|
---|
119 | <li><a href="fixtureTeardown.html">TestFixtureTearDown</a></li>
|
---|
120 | <li><a href="theory.html">Theory</a></li>
|
---|
121 | <li><a href="timeout.html">Timeout</a></li>
|
---|
122 | <li><a href="values.html">Values</a></li>
|
---|
123 | <li><a href="valueSource.html">ValueSource</a></li>
|
---|
124 | </ul>
|
---|
125 | <li><a href="runningTests.html">Running Tests</a></li>
|
---|
126 | <li><a href="extensibility.html">Extensibility</a></li>
|
---|
127 | <li><a href="releaseNotes.html">Release Notes</a></li>
|
---|
128 | <li><a href="samples.html">Samples</a></li>
|
---|
129 | <li><a href="license.html">License</a></li>
|
---|
130 | </ul>
|
---|
131 | </ul>
|
---|
132 | </div>
|
---|
133 | <!-- End of Submenu -->
|
---|
134 |
|
---|
135 |
|
---|
136 | <!-- Standard Footer for NUnit.org -->
|
---|
137 | <div id="footer">
|
---|
138 | Copyright © 2010 Charlie Poole. All Rights Reserved.
|
---|
139 | </div>
|
---|
140 | <!-- End of Footer -->
|
---|
141 |
|
---|
142 | </body>
|
---|
143 | </html>
|
---|