NUnit - SetCulture

### SetCultureAttribute (NUnit 2.4.2)

The SetCulture attribute is used to set the current Culture for the duration of a test. It may be specified at the level of a test or a fixture. The culture remains set until the test or fixture completes and is then reset to its original value. If you wish to use the current culture setting to decide whether to run a test, use the Culture attribute instead of this one.

Only one culture may be specified. Running a test under multiple cultures is a planned future enhancement. At this time, you can achieve the same result by factoring out your test code into a private method that is called by each individual test method.

#### Examples:

C#
VB
C++
J#

    namespace NUnit.Tests
    {
      using System;
      using NUnit.Framework;

      [TestFixture]
      [SetCulture("fr-FR")]
      public class FrenchCultureTests
      {
        // ...
      }
    }

    Imports System
    Imports Nunit.Framework

    Namespace Nunit.Tests

      <TestFixture(), SetCulture("fr-FR")>
      Public Class FrenchCultureTests
        ' ...
      End Class
    End Namespace

    #using <Nunit.Framework.dll>
    using namespace System;
    using namespace NUnit::Framework;

    namespace NUnitTests
    {
      [TestFixture]
      [SetCulture("fr-FR")]
      public __gc class FrenchCultureTests
      {
        // ...
      };
    }

    #include "cppsample.h"

    namespace NUnitTests {
      // ...
    }

    package NUnit.Tests;

    import System.*;
    import NUnit.Framework.TestFixture;

    /** @attribute NUnit.Framework.TestFixture() */
    /** @attribute NUnit.Framework.SetCulture("fr-FR") */
    public class FrenchCultureTests
    {
      // ...
    }

#### See also...

- CultureAttribute