-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Part 2b: a better approach without requiring to fork NUnit
- Loading branch information
Showing
7 changed files
with
70 additions
and
77 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
38 changes: 38 additions & 0 deletions
38
src/NUnit.Extensions.TestOrdering/EnabledTestFixtureOrderingAttribute.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
// ****************************************************************************** | ||
// © 2016 Ernst & Young - www.ey.com | www.beco.nl | ||
// | ||
// Author : Ernst & Young - Cleantech and Sustainability | ||
// File: : OrderedTestAssemblyAttribute.cs | ||
// Project : BankAccountApp.NUnitTests.Integration | ||
// ****************************************************************************** | ||
|
||
namespace NUnit.Extensions.TestOrdering { | ||
using System; | ||
|
||
using Framework.Interfaces; | ||
using Framework.Internal; | ||
|
||
/// <summary> | ||
/// To be applied to assemblies which require tests to be ordered | ||
/// </summary> | ||
[AttributeUsage(AttributeTargets.Assembly)] | ||
public sealed class EnabledTestFixtureOrderingAttribute : Attribute, IApplyToTest { | ||
public void ApplyToTest(Test test) { | ||
if (test == null) throw new ArgumentNullException(nameof(test)); | ||
|
||
TestAssembly testAssembly = test as TestAssembly; | ||
|
||
if (testAssembly == null) { | ||
throw new ArgumentException($"Excepted argument \"{nameof(test)}\" to be of type {typeof(TestAssembly)} but was type {test.GetType()} instead", nameof(testAssembly)); | ||
} | ||
|
||
OrderTestAssemblyTests(testAssembly); | ||
} | ||
|
||
private static void OrderTestAssemblyTests(TestAssembly testAssembly) { | ||
OrderedTreeBuilder treeBuilder = new OrderedTreeBuilder(testAssembly); | ||
treeBuilder.Add(testAssembly); | ||
treeBuilder.Complete(); | ||
} | ||
} | ||
} |
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
56 changes: 0 additions & 56 deletions
56
src/NUnit.Extensions.TestOrdering/OrderedTestAssemblyBuilder.cs
This file was deleted.
Oops, something went wrong.
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