TestEnvironment Class
Provides information about the environment the test suite is running in.
public static class TestEnvironmentMethods
| Name | Description |
|---|---|
| IsGlobalizationInvariant() | Determines whether the application runs in invariant globalization mode. |
| IsOnContinuousIntegration(ContinuousIntegrationEnvironments) | Determines whether the test suite runs on one of the specified continuous integration environments. |
| IsOnGitHubActions() | Determines whether the test suite runs on GitHub Actions. |
IsGlobalizationInvariant()
TestEnvironment.csDetermines whether the application runs in invariant globalization mode.
public static bool IsGlobalizationInvariant()Returns
bool true when invariant globalization mode is enabled; otherwise false.
Remarks
This mirrors how the runtime resolves the setting: the System.Globalization.Invariant switch, which is set by the InvariantGlobalization MSBuild property, takes precedence over the DOTNET_SYSTEM_GLOBALIZATION_INVARIANT environment variable.
IsOnContinuousIntegration(ContinuousIntegrationEnvironments)
TestEnvironment.csDetermines whether the test suite runs on one of the specified continuous integration environments.
public static bool IsOnContinuousIntegration(ContinuousIntegrationEnvironments environment)Parameters
environmentContinuousIntegrationEnvironments- The continuous integration environments to test for.
Returns
bool true when the test suite runs on any of the specified environments; otherwise false.