Search code examples
c#unit-testinglocalizationlocale

C# How can I force Localization Culture to en-US for tests project


How to specify concrente Localization Culture for tests project in C# in VS2008? I'm building Asp .Net MVC app that has nonstandard culture specified in web.config but how to set the same culture for unit tests for that project?


Solution

  • You may set

    Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US"); 
    

    in method that is marked as "test initializer" in your unit testing framework.