Closed arlm closed 4 years ago
Hmmm... We could force the culture to en in the test class constructor.
I will try that on my machine this week and see the result.
FYI this can be done with code such as this:
System.Threading.Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("en-US");
OK. I use it on most of the things I develop. I tend to prefer to explicitly set the culture on everything that has no localization support so that the strings and formatting (dates, currency and numbers) don't play tricks on the user.
I just thought there could be a way to setup these on appveyor or some other configuration file or attribute instead of setting this on all instances before running on our tests.
If there is such a way, I'm not aware of it.
NUnit include this by default via attributes,
The same type of attribute can be written for XUnit to add this to individual tests. https://github.com/Humanizr/Humanizer/blob/dev/src/Humanizer.Tests.Shared/UseCultureAttribute.cs seem to be a sample of that but I didn't try it.
Closing due to a workaround being available or lack of popular demand. This allows us to better focus on high impact issues. If you feel this is blocking you, you may add a comment here to explain why this should be prioritized.
Thank you for your understanding.
My machine is setup to German language, so some of the tests, that do test the exception text fail on my machine due to different language on the Exception message. Is there an easy fix to setup the language/Culture during tests? It does happen when I use the build.cmd/build.ps1 scripts.