-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
48 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 2 additions & 4 deletions
6
tests/Avalonia.Base.UnitTests/Data/Core/ExpressionObserverTests_DataValidation.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
#nullable enable | ||
|
||
using System; | ||
using System.Globalization; | ||
using System.Reflection; | ||
using Xunit.Sdk; | ||
|
||
namespace Avalonia.UnitTests; | ||
|
||
/// <summary> | ||
/// Runs tests in the invariant culture. | ||
/// </summary> | ||
/// <remarks> | ||
/// Some tests check exception messages, and those from the .NET framework will be translated. | ||
/// Some tests are formatting numbers, expecting a dot as a decimal point. | ||
/// Use this fixture to set the current culture to the invariant culture. | ||
/// </remarks> | ||
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Method)] | ||
public sealed class InvariantCultureAttribute : BeforeAfterTestAttribute | ||
{ | ||
private CultureInfo? _previousCulture; | ||
private CultureInfo? _previousUICulture; | ||
|
||
public override void Before(MethodInfo methodUnderTest) | ||
{ | ||
base.Before(methodUnderTest); | ||
|
||
_previousCulture = CultureInfo.CurrentCulture; | ||
_previousUICulture = CultureInfo.CurrentUICulture; | ||
|
||
CultureInfo.CurrentCulture = CultureInfo.InvariantCulture; | ||
CultureInfo.CurrentUICulture = CultureInfo.InvariantCulture; | ||
} | ||
|
||
public override void After(MethodInfo methodUnderTest) | ||
{ | ||
CultureInfo.CurrentCulture = _previousCulture!; | ||
CultureInfo.CurrentUICulture = _previousUICulture!; | ||
|
||
base.After(methodUnderTest); | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.