nunitculture

NUnit, testing against multiple cultures


Using NUnit I wish to run all the tests in a certain project against multiple cultures.

The project deals with parsing data that should be culture neutral, to ensure this I would like to run every test against multiple cultures.

The current solution I have is

public abstract class FooTests {
    /* tests go here */
}

[TestFixture, SetCulture ("en-GB")] public class FooTestsEN : FooTests {}
[TestFixture, SetCulture ("pl-PL")] public class FooTestsPL : FooTests {}

Ideally, I shouldn't have to create these classes and instead use something like:

[assembly: SetCulture ("en-GB")]
[assembly: SetCulture ("pl-PL")]

Solution

  • Unfortunatelly this isn't possible now but is planned for future.

    You can also do this.

    public class AllCultureTests
    {
      private TestSomething() {...}
    
      [Test]
      [SetCulture("pl-PL")]
      public void ShouldDoSomethingInPoland()
      {
        TestSomething();
      }
    }

    Maybe that's something you would prefer?