-
Notifications
You must be signed in to change notification settings - Fork 386
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix tests failing due to manipulating shared static state
Move unit abbreviations out of UnitInfo and into UnitAbbreviationsCache, so manipulating one cache instance won't affect another instance.
- Loading branch information
1 parent
5629acc
commit 34d4193
Showing
8 changed files
with
283 additions
and
124 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
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,29 @@ | ||
// Licensed under MIT No Attribution, see LICENSE file at the root. | ||
// Copyright 2013 Andreas Gullberg Larsen ([email protected]). Maintained at https://github.com/angularsen/UnitsNet. | ||
|
||
using System.Collections.Generic; | ||
using System.Linq; | ||
using Xunit.Abstractions; | ||
using Xunit.Sdk; | ||
|
||
namespace UnitsNet.Tests; | ||
|
||
/// <summary> | ||
/// Useful for debugging tests where a particular order of tests is required. | ||
/// </summary> | ||
/// <example> | ||
/// Add the attribute to your test class: | ||
/// <code> | ||
/// <![CDATA[ | ||
/// [TestCaseOrderer( | ||
/// ordererTypeName: "UnitsNet.Tests.AlphabeticalOrderer", | ||
/// ordererAssemblyName: "UnitsNet.Tests")] | ||
/// ]]> | ||
/// </code> | ||
/// </example> | ||
public class AlphabeticalOrderer : ITestCaseOrderer | ||
{ | ||
public IEnumerable<TTestCase> OrderTestCases<TTestCase>( | ||
IEnumerable<TTestCase> testCases) where TTestCase : ITestCase => | ||
testCases.OrderBy(testCase => testCase.TestMethod.Method.Name); | ||
} |
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
Oops, something went wrong.