[1146] | 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 - Culture</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 | <script language="JavaScript" src="codeFuncs.js" ></script> <!-- Do it this way for IE -->
|
---|
| 28 |
|
---|
| 29 | <style><!--
|
---|
| 30 | div.code { width: 34em }
|
---|
| 31 | --></style>
|
---|
| 32 |
|
---|
| 33 | <h3>CultureAttribute (NUnit 2.4.2)</h3>
|
---|
| 34 | <p>The Culture attribute is used to specify cultures for which a test or fixture
|
---|
| 35 | should be run. It does not affect the culture setting, but merely uses it to
|
---|
| 36 | determine whether to run the test. If you wish to change the culture when
|
---|
| 37 | running a test, use the SetCulture attribute instead.</p>
|
---|
| 38 |
|
---|
| 39 | <p>If the specified culture requirements for a test are not met it is skipped.
|
---|
| 40 | In the gui, the tree node for the test remains gray and the status bar color is
|
---|
| 41 | not affected.</p>
|
---|
| 42 |
|
---|
| 43 | <p>One use of the Culture attribute is to provide alternative tests under different
|
---|
| 44 | cultures. You may specify either specific cultures, like "en-GB" or neutral
|
---|
| 45 | cultures like "de".</p>
|
---|
| 46 |
|
---|
| 47 | <h4>Test Fixture Syntax</h4>
|
---|
| 48 |
|
---|
| 49 | <div class="code">
|
---|
| 50 |
|
---|
| 51 | <div class="langFilter">
|
---|
| 52 | <a href="javascript:Show('DD1')" onmouseover="Show('DD1')"><img src="img/langFilter.gif" width="14" height="14" alt="Language Filter"></a>
|
---|
| 53 | <div id="DD1" class="dropdown" style="display: none;" onclick="Hide('DD1')">
|
---|
| 54 | <a href="javascript:ShowCS()">C#</a><br>
|
---|
| 55 | <a href="javascript:ShowVB()">VB</a><br>
|
---|
| 56 | <a href="javascript:ShowMC()">C++</a><br>
|
---|
| 57 | <a href="javascript:ShowJS()">J#</a><br>
|
---|
| 58 | </div>
|
---|
| 59 | </div>
|
---|
| 60 |
|
---|
| 61 | <pre class="cs">namespace NUnit.Tests
|
---|
| 62 | {
|
---|
| 63 | using System;
|
---|
| 64 | using NUnit.Framework;
|
---|
| 65 |
|
---|
| 66 | [TestFixture]
|
---|
| 67 | [Culture("fr-FR")]
|
---|
| 68 | public class FrenchCultureTests
|
---|
| 69 | {
|
---|
| 70 | // ...
|
---|
| 71 | }
|
---|
| 72 | }
|
---|
| 73 | </pre>
|
---|
| 74 |
|
---|
| 75 | <pre class="vb">Imports System
|
---|
| 76 | Imports Nunit.Framework
|
---|
| 77 |
|
---|
| 78 | Namespace Nunit.Tests
|
---|
| 79 |
|
---|
| 80 | <TestFixture(), Culture("fr-FR")>
|
---|
| 81 | Public Class FrenchCultureTests
|
---|
| 82 | ' ...
|
---|
| 83 | End Class
|
---|
| 84 | End Namespace
|
---|
| 85 | </pre>
|
---|
| 86 |
|
---|
| 87 | <pre class="mc">#using <Nunit.Framework.dll>
|
---|
| 88 | using namespace System;
|
---|
| 89 | using namespace NUnit::Framework;
|
---|
| 90 |
|
---|
| 91 | namespace NUnitTests
|
---|
| 92 | {
|
---|
| 93 | [TestFixture]
|
---|
| 94 | [Culture("fr-FR")]
|
---|
| 95 | public __gc class FrenchCultureTests
|
---|
| 96 | {
|
---|
| 97 | // ...
|
---|
| 98 | };
|
---|
| 99 | }
|
---|
| 100 |
|
---|
| 101 | #include "cppsample.h"
|
---|
| 102 |
|
---|
| 103 | namespace NUnitTests {
|
---|
| 104 | // ...
|
---|
| 105 | }
|
---|
| 106 | </pre>
|
---|
| 107 |
|
---|
| 108 | <pre class="js">package NUnit.Tests;
|
---|
| 109 |
|
---|
| 110 | import System.*;
|
---|
| 111 | import NUnit.Framework.TestFixture;
|
---|
| 112 |
|
---|
| 113 |
|
---|
| 114 | /** @attribute NUnit.Framework.TestFixture() */
|
---|
| 115 | /** @attribute NUnit.Framework.Culture("fr-FR") */
|
---|
| 116 | public class FrenchCultureTests
|
---|
| 117 | {
|
---|
| 118 | // ...
|
---|
| 119 | }
|
---|
| 120 | </pre>
|
---|
| 121 | </div>
|
---|
| 122 | <h4>Test Syntax</h4>
|
---|
| 123 | <div class="code">
|
---|
| 124 |
|
---|
| 125 | <div class="langFilter">
|
---|
| 126 | <a href="javascript:Show('DD2')" onmouseover="Show('DD2')"><img src="img/langFilter.gif" width="14" height="14" alt="Language Filter"></a>
|
---|
| 127 | <div id="DD2" class="dropdown" style="display: none;" onclick="Hide('DD2')">
|
---|
| 128 | <a href="javascript:ShowCS()">C#</a><br>
|
---|
| 129 | <a href="javascript:ShowVB()">VB</a><br>
|
---|
| 130 | <a href="javascript:ShowMC()">C++</a><br>
|
---|
| 131 | <a href="javascript:ShowJS()">J#</a><br>
|
---|
| 132 | </div>
|
---|
| 133 | </div>
|
---|
| 134 |
|
---|
| 135 | <pre class="cs">namespace NUnit.Tests
|
---|
| 136 | {
|
---|
| 137 | using System;
|
---|
| 138 | using NUnit.Framework;
|
---|
| 139 |
|
---|
| 140 | [TestFixture]
|
---|
| 141 | public class SuccessTests
|
---|
| 142 | {
|
---|
| 143 | [Test]
|
---|
| 144 | [Culture(Exclude="en,de")]
|
---|
| 145 | public void SomeTest()
|
---|
| 146 | { /* ... */ }
|
---|
| 147 | }
|
---|
| 148 | </pre>
|
---|
| 149 |
|
---|
| 150 | <pre class="vb">Imports System
|
---|
| 151 | Imports Nunit.Framework
|
---|
| 152 |
|
---|
| 153 | Namespace Nunit.Tests
|
---|
| 154 |
|
---|
| 155 | <TestFixture()>
|
---|
| 156 | Public Class SuccessTests
|
---|
| 157 | <Test(), Culture(Exclude="en,de")> Public Sub SomeTest()
|
---|
| 158 | ' ...
|
---|
| 159 | End Sub
|
---|
| 160 | End Class
|
---|
| 161 | End Namespace
|
---|
| 162 | </pre>
|
---|
| 163 |
|
---|
| 164 | <pre class="mc">#using <Nunit.Framework.dll>
|
---|
| 165 | using namespace System;
|
---|
| 166 | using namespace NUnit::Framework;
|
---|
| 167 |
|
---|
| 168 | namespace NUnitTests
|
---|
| 169 | {
|
---|
| 170 | [TestFixture]
|
---|
| 171 | public __gc class SuccessTests
|
---|
| 172 | {
|
---|
| 173 | [Test][Culture(Exclude="en,de")] void SomeTest();
|
---|
| 174 | };
|
---|
| 175 | }
|
---|
| 176 |
|
---|
| 177 | #include "cppsample.h"
|
---|
| 178 |
|
---|
| 179 | namespace NUnitTests {
|
---|
| 180 | // ...
|
---|
| 181 | }
|
---|
| 182 | </pre>
|
---|
| 183 |
|
---|
| 184 | <pre class="js">package NUnit.Tests;
|
---|
| 185 |
|
---|
| 186 | import System.*;
|
---|
| 187 | import NUnit.Framework.TestFixture;
|
---|
| 188 |
|
---|
| 189 |
|
---|
| 190 | /** @attribute NUnit.Framework.TestFixture() */
|
---|
| 191 | public class SuccessTests
|
---|
| 192 | {
|
---|
| 193 | /** @attribute NUnit.Framework.Test() */
|
---|
| 194 | /** @attribute NUnit.Framework.Culture(Exclude=en,de") */
|
---|
| 195 | public void SomeTest()
|
---|
| 196 | { /* ... */ }
|
---|
| 197 | }
|
---|
| 198 | </pre>
|
---|
| 199 |
|
---|
| 200 | </div>
|
---|
| 201 |
|
---|
| 202 | <h4>See also...</h4>
|
---|
| 203 | <ul>
|
---|
| 204 | <li><a href="setCulture.html">SetCultureAttribute</a></ul>
|
---|
| 205 |
|
---|
| 206 |
|
---|
| 207 | </div>
|
---|
| 208 |
|
---|
| 209 | <!-- Submenu -->
|
---|
| 210 | <div id="subnav">
|
---|
| 211 | <ul>
|
---|
| 212 | <li><a href="index.html">NUnit 2.5.10</a></li>
|
---|
| 213 | <ul>
|
---|
| 214 | <li><a href="getStarted.html">Getting Started</a></li>
|
---|
| 215 | <li><a href="assertions.html">Assertions</a></li>
|
---|
| 216 | <li><a href="constraintModel.html">Constraints</a></li>
|
---|
| 217 | <li><a href="attributes.html">Attributes</a></li>
|
---|
| 218 | <ul>
|
---|
| 219 | <li><a href="category.html">Category</a></li>
|
---|
| 220 | <li><a href="combinatorial.html">Combinatorial</a></li>
|
---|
| 221 | <li id="current"><a href="culture.html">Culture</a></li>
|
---|
| 222 | <li><a href="datapoint.html">Datapoint(s)</a></li>
|
---|
| 223 | <li><a href="description.html">Description</a></li>
|
---|
| 224 | <li><a href="exception.html">Exception</a></li>
|
---|
| 225 | <li><a href="explicit.html">Explicit</a></li>
|
---|
| 226 | <li><a href="ignore.html">Ignore</a></li>
|
---|
| 227 | <li><a href="maxtime.html">Maxtime</a></li>
|
---|
| 228 | <li><a href="pairwise.html">Pairwise</a></li>
|
---|
| 229 | <li><a href="platform.html">Platform</a></li>
|
---|
| 230 | <li><a href="property.html">Property</a></li>
|
---|
| 231 | <li><a href="random.html">Random</a></li>
|
---|
| 232 | <li><a href="range.html">Range</a></li>
|
---|
| 233 | <li><a href="repeat.html">Repeat</a></li>
|
---|
| 234 | <li><a href="requiredAddin.html">RequiredAddin</a></li>
|
---|
| 235 | <li><a href="requiresMTA.html">Requires MTA</a></li>
|
---|
| 236 | <li><a href="requiresSTA.html">Requires STA</a></li>
|
---|
| 237 | <li><a href="requiresThread.html">Requires Thread</a></li>
|
---|
| 238 | <li><a href="sequential.html">Sequential</a></li>
|
---|
| 239 | <li><a href="setCulture.html">SetCulture</a></li>
|
---|
| 240 | <li><a href="setUICulture.html">SetUICulture</a></li>
|
---|
| 241 | <li><a href="setup.html">Setup</a></li>
|
---|
| 242 | <li><a href="setupFixture.html">SetupFixture</a></li>
|
---|
| 243 | <li><a href="suite.html">Suite</a></li>
|
---|
| 244 | <li><a href="teardown.html">Teardown</a></li>
|
---|
| 245 | <li><a href="test.html">Test</a></li>
|
---|
| 246 | <li><a href="testCase.html">TestCase</a></li>
|
---|
| 247 | <li><a href="testCaseSource.html">TestCaseSource</a></li>
|
---|
| 248 | <li><a href="testFixture.html">TestFixture</a></li>
|
---|
| 249 | <li><a href="fixtureSetup.html">TestFixtureSetUp</a></li>
|
---|
| 250 | <li><a href="fixtureTeardown.html">TestFixtureTearDown</a></li>
|
---|
| 251 | <li><a href="theory.html">Theory</a></li>
|
---|
| 252 | <li><a href="timeout.html">Timeout</a></li>
|
---|
| 253 | <li><a href="values.html">Values</a></li>
|
---|
| 254 | <li><a href="valueSource.html">ValueSource</a></li>
|
---|
| 255 | </ul>
|
---|
| 256 | <li><a href="runningTests.html">Running Tests</a></li>
|
---|
| 257 | <li><a href="extensibility.html">Extensibility</a></li>
|
---|
| 258 | <li><a href="releaseNotes.html">Release Notes</a></li>
|
---|
| 259 | <li><a href="samples.html">Samples</a></li>
|
---|
| 260 | <li><a href="license.html">License</a></li>
|
---|
| 261 | </ul>
|
---|
| 262 | </ul>
|
---|
| 263 | </div>
|
---|
| 264 | <!-- End of Submenu -->
|
---|
| 265 |
|
---|
| 266 |
|
---|
| 267 | <!-- Standard Footer for NUnit.org -->
|
---|
| 268 | <div id="footer">
|
---|
| 269 | Copyright © 2010 Charlie Poole. All Rights Reserved.
|
---|
| 270 | </div>
|
---|
| 271 | <!-- End of Footer -->
|
---|
| 272 |
|
---|
| 273 | </body>
|
---|
| 274 | </html>
|
---|