Unit tests in non-english environment

Topics: General
Jan 28, 2013 at 2:03 PM


I've just set up a development environment on my computer (French Windows 7 with Visual Studio 2010 Professional), following the instructions at http://docs.nuget.org/docs/contribute/Setting-up-the-NuGet-Development-Environment

- I've had a first issue with running build.cmd as VS2010Pro doesn't include FxCop.

I've worked around it by following commentting out the error as recommended here: http://nuget.codeplex.com/discussions/241550

- Now, I'm noticing quite a few unit test failures.

They (all?) seem to come down to hardcoded localized strings in the unit tests.


- http://nuget.codeplex.com/SourceControl/changeset/view/0b1e224884a3#test/Test.Utility/ExceptionAssert.cs (line 9, "Parameter Name")

- http://nuget.codeplex.com/SourceControl/changeset/view/0b1e224884a3#test/CommandLine.Test/InstallCommandTest.cs (line 722, the whole explanation message about enabling package restore)


Is there a way I can launch the unit test in a english culture ?

Of not would you be interested in patches to make the tests less culture dependent? (I know I would be, as I can't easily ignore all those errors).

Jan 28, 2013 at 8:36 PM

You can force unit test to run in English culture by adding a custom MSBuild task just before the call to xunit. This custom task will set the current thread culture to English. See this thread for an idea:


Jan 29, 2013 at 10:47 AM
Edited Jan 29, 2013 at 11:56 AM


Thanks for the hint, I can look into it.


- MsBuild runs all in a single thread ?

- Even if it does, some nuget commands run in multiple threads (and in each new thread the culture is reset :/), so I'm afraid this approach won't work so well :-/

Jan 29, 2013 at 5:55 PM

I tried a different approach, fixing the tests on a case by case basis. The results are in this pull request:


Does that look like something that may be accepted?