MSTest Host culture definition

I am trying to fix our project integration test suite, which is based on MSTest and is testing an extension for Visual Studio. These MSTest tests run from a new instance of Visual Studio (which is configured as a test node). During testing on different computers, we found that, since different computers have slightly different regional settings (the default culture), the strings returned from Visual Studio also differ slightly in their formatting.

My question is, is there a way, using MSTest with the "VS IDE" as the host, to set CultureInfo to the default value so that we can get consistent results on different test machines?

+4
source share
1 answer

I tried to solve the same problem and finally came across AssemblyInitializeAttribute . You can use it to install DefaultThreadCurrentUICultureand DefaultThreadCurrentCultureto run any of your tests.

One important thing to consider when using this attribute:

Only one assembly method can be decorated with this attribute.

The loan for the decision is sent to Bart Wullems .

0
source

Source: https://habr.com/ru/post/1532024/


All Articles