[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 - SetUICulture</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>SetUICultureAttribute (NUnit 2.5.2)</h3>
|
---|
| 34 | <p>The SetUICulture attribute is used to set the current UI Culture for the duration
|
---|
| 35 | of a test. It may be specified at the level of a test or a fixture. The UI culture
|
---|
| 36 | remains set until the test or fixture completes and is then reset to its original
|
---|
| 37 | value. If you wish to use the current culture setting to decide whether to run
|
---|
| 38 | a test, use the Culture attribute instead of this one.</p>
|
---|
| 39 |
|
---|
| 40 | <p>Only one culture may be specified. Running a test under
|
---|
| 41 | multiple cultures is a planned future enhancement. At this time, you can
|
---|
| 42 | achieve the same result by factoring out your test code into a private method
|
---|
| 43 | that is called by each individual test method.</p>
|
---|
| 44 |
|
---|
| 45 | <h4>Examples:</h4>
|
---|
| 46 |
|
---|
| 47 | <div class="code">
|
---|
| 48 |
|
---|
| 49 | <div class="langFilter">
|
---|
| 50 | <a href="javascript:Show('DD1')" onmouseover="Show('DD1')"><img src="img/langFilter.gif" width="14" height="14" alt="Language Filter"></a>
|
---|
| 51 | <div id="DD1" class="dropdown" style="display: none;" onclick="Hide('DD1')">
|
---|
| 52 | <a href="javascript:ShowCS()">C#</a><br>
|
---|
| 53 | <a href="javascript:ShowVB()">VB</a><br>
|
---|
| 54 | <a href="javascript:ShowMC()">C++</a><br>
|
---|
| 55 | <a href="javascript:ShowJS()">J#</a><br>
|
---|
| 56 | </div>
|
---|
| 57 | </div>
|
---|
| 58 |
|
---|
| 59 | <pre class="cs">namespace NUnit.Tests
|
---|
| 60 | {
|
---|
| 61 | using System;
|
---|
| 62 | using NUnit.Framework;
|
---|
| 63 |
|
---|
| 64 | [TestFixture]
|
---|
| 65 | [SetUICulture("fr-FR")]
|
---|
| 66 | public class FrenchCultureTests
|
---|
| 67 | {
|
---|
| 68 | // ...
|
---|
| 69 | }
|
---|
| 70 | }
|
---|
| 71 | </pre>
|
---|
| 72 |
|
---|
| 73 | <pre class="vb">Imports System
|
---|
| 74 | Imports Nunit.Framework
|
---|
| 75 |
|
---|
| 76 | Namespace Nunit.Tests
|
---|
| 77 |
|
---|
| 78 | <TestFixture(), SetUICulture("fr-FR")>
|
---|
| 79 | Public Class FrenchCultureTests
|
---|
| 80 | ' ...
|
---|
| 81 | End Class
|
---|
| 82 | End Namespace
|
---|
| 83 | </pre>
|
---|
| 84 |
|
---|
| 85 | <pre class="mc">#using <Nunit.Framework.dll>
|
---|
| 86 | using namespace System;
|
---|
| 87 | using namespace NUnit::Framework;
|
---|
| 88 |
|
---|
| 89 | namespace NUnitTests
|
---|
| 90 | {
|
---|
| 91 | [TestFixture]
|
---|
| 92 | [SetUICulture("fr-FR")]
|
---|
| 93 | public __gc class FrenchCultureTests
|
---|
| 94 | {
|
---|
| 95 | // ...
|
---|
| 96 | };
|
---|
| 97 | }
|
---|
| 98 |
|
---|
| 99 | #include "cppsample.h"
|
---|
| 100 |
|
---|
| 101 | namespace NUnitTests {
|
---|
| 102 | // ...
|
---|
| 103 | }
|
---|
| 104 | </pre>
|
---|
| 105 |
|
---|
| 106 | <pre class="js">package NUnit.Tests;
|
---|
| 107 |
|
---|
| 108 | import System.*;
|
---|
| 109 | import NUnit.Framework.TestFixture;
|
---|
| 110 |
|
---|
| 111 |
|
---|
| 112 | /** @attribute NUnit.Framework.TestFixture() */
|
---|
| 113 | /** @attribute NUnit.Framework.SetUICulture("fr-FR") */
|
---|
| 114 | public class FrenchCultureTests
|
---|
| 115 | {
|
---|
| 116 | // ...
|
---|
| 117 | }
|
---|
| 118 | </pre>
|
---|
| 119 | </div>
|
---|
| 120 |
|
---|
| 121 | <h4>See also...</h4>
|
---|
| 122 | <ul>
|
---|
| 123 | <li><a href="culture.html">CultureAttribute</a><li><a href="setCulture.html">SetCultureAttribute</a></ul>
|
---|
| 124 |
|
---|
| 125 | </div>
|
---|
| 126 |
|
---|
| 127 | <!-- Submenu -->
|
---|
| 128 | <div id="subnav">
|
---|
| 129 | <ul>
|
---|
| 130 | <li><a href="index.html">NUnit 2.5.10</a></li>
|
---|
| 131 | <ul>
|
---|
| 132 | <li><a href="getStarted.html">Getting Started</a></li>
|
---|
| 133 | <li><a href="assertions.html">Assertions</a></li>
|
---|
| 134 | <li><a href="constraintModel.html">Constraints</a></li>
|
---|
| 135 | <li><a href="attributes.html">Attributes</a></li>
|
---|
| 136 | <ul>
|
---|
| 137 | <li><a href="category.html">Category</a></li>
|
---|
| 138 | <li><a href="combinatorial.html">Combinatorial</a></li>
|
---|
| 139 | <li><a href="culture.html">Culture</a></li>
|
---|
| 140 | <li><a href="datapoint.html">Datapoint(s)</a></li>
|
---|
| 141 | <li><a href="description.html">Description</a></li>
|
---|
| 142 | <li><a href="exception.html">Exception</a></li>
|
---|
| 143 | <li><a href="explicit.html">Explicit</a></li>
|
---|
| 144 | <li><a href="ignore.html">Ignore</a></li>
|
---|
| 145 | <li><a href="maxtime.html">Maxtime</a></li>
|
---|
| 146 | <li><a href="pairwise.html">Pairwise</a></li>
|
---|
| 147 | <li><a href="platform.html">Platform</a></li>
|
---|
| 148 | <li><a href="property.html">Property</a></li>
|
---|
| 149 | <li><a href="random.html">Random</a></li>
|
---|
| 150 | <li><a href="range.html">Range</a></li>
|
---|
| 151 | <li><a href="repeat.html">Repeat</a></li>
|
---|
| 152 | <li><a href="requiredAddin.html">RequiredAddin</a></li>
|
---|
| 153 | <li><a href="requiresMTA.html">Requires MTA</a></li>
|
---|
| 154 | <li><a href="requiresSTA.html">Requires STA</a></li>
|
---|
| 155 | <li><a href="requiresThread.html">Requires Thread</a></li>
|
---|
| 156 | <li><a href="sequential.html">Sequential</a></li>
|
---|
| 157 | <li><a href="setCulture.html">SetCulture</a></li>
|
---|
| 158 | <li id="current"><a href="setUICulture.html">SetUICulture</a></li>
|
---|
| 159 | <li><a href="setup.html">Setup</a></li>
|
---|
| 160 | <li><a href="setupFixture.html">SetupFixture</a></li>
|
---|
| 161 | <li><a href="suite.html">Suite</a></li>
|
---|
| 162 | <li><a href="teardown.html">Teardown</a></li>
|
---|
| 163 | <li><a href="test.html">Test</a></li>
|
---|
| 164 | <li><a href="testCase.html">TestCase</a></li>
|
---|
| 165 | <li><a href="testCaseSource.html">TestCaseSource</a></li>
|
---|
| 166 | <li><a href="testFixture.html">TestFixture</a></li>
|
---|
| 167 | <li><a href="fixtureSetup.html">TestFixtureSetUp</a></li>
|
---|
| 168 | <li><a href="fixtureTeardown.html">TestFixtureTearDown</a></li>
|
---|
| 169 | <li><a href="theory.html">Theory</a></li>
|
---|
| 170 | <li><a href="timeout.html">Timeout</a></li>
|
---|
| 171 | <li><a href="values.html">Values</a></li>
|
---|
| 172 | <li><a href="valueSource.html">ValueSource</a></li>
|
---|
| 173 | </ul>
|
---|
| 174 | <li><a href="runningTests.html">Running Tests</a></li>
|
---|
| 175 | <li><a href="extensibility.html">Extensibility</a></li>
|
---|
| 176 | <li><a href="releaseNotes.html">Release Notes</a></li>
|
---|
| 177 | <li><a href="samples.html">Samples</a></li>
|
---|
| 178 | <li><a href="license.html">License</a></li>
|
---|
| 179 | </ul>
|
---|
| 180 | </ul>
|
---|
| 181 | </div>
|
---|
| 182 | <!-- End of Submenu -->
|
---|
| 183 |
|
---|
| 184 |
|
---|
| 185 | <!-- Standard Footer for NUnit.org -->
|
---|
| 186 | <div id="footer">
|
---|
| 187 | Copyright © 2010 Charlie Poole. All Rights Reserved.
|
---|
| 188 | </div>
|
---|
| 189 | <!-- End of Footer -->
|
---|
| 190 |
|
---|
| 191 | </body>
|
---|
| 192 | </html>
|
---|