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

mgamer picture mgamer · Feb 15, 2011 · Viewed 28.5k times · Source

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?

Answer

Tony Kh picture Tony Kh · Feb 15, 2011

You may set

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

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