Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions src/RapidIntegrationTesting.xUnit/TestOrderer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,19 @@ namespace RapidIntegrationTesting.xUnit;

/// <summary>
/// Handels the correct ordering of test cases marked with <see cref="TestOrderAttribute" />
/// To register it, use the XUnit attribute: [TestCaseOrderer(nameof(TestOrderer), TestOrderer.AssemblyName)]
/// To register it, use the XUnit attribute: [TestOrderer.TypeName, TestOrderer.AssemblyName)]
/// </summary>
public class TestOrderer : ITestCaseOrderer
{
/// <summary>
/// Type name of the <see cref="TestOrderer" />. Used in the XUnit attribute "TestCaseOrderer"
/// </summary>
public const string TypeName = "Testing.Utility.TestOrderer";
public const string TypeName = "RapidIntegrationTesting.xUnit.TestOrderer";

/// <summary>
/// Assembly name of the <see cref="TestOrderer" />. Used in the XUnit attribute "TestCaseOrderer"
/// </summary>
public const string AssemblyName = "Testing.Utility";
public const string AssemblyName = "RapidIntegrationTesting.xUnit";

private readonly IMessageSink _diagnosticMessageSink;

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
using RapidIntegrationTesting.xUnit;

namespace RapidIntegrationTesting.Integration.Tests.Tests;

[TestCaseOrderer(TestOrderer.TypeName, TestOrderer.AssemblyName)]
public class TestOrdererTests
{
private static bool _testOneRun;
private static bool _testTwoRun;
private static bool _testThreeRun;
private static bool _testFourRun;

[Fact]
[TestOrder(3)]
public void Three()
{
Assert.True(_testOneRun);
Assert.True(_testTwoRun);
Assert.False(_testThreeRun);
Assert.False(_testFourRun);

_testThreeRun = true;
}

[Fact]
[TestOrder(1)]
public void One()
{

Assert.False(_testOneRun);
Assert.False(_testTwoRun);
Assert.False(_testThreeRun);
Assert.False(_testFourRun);

_testOneRun = true;
}

[Fact]
[TestOrder(4)]
public void Four()
{
Assert.True(_testOneRun);
Assert.True(_testTwoRun);
Assert.True(_testThreeRun);
Assert.False(_testFourRun);

_testFourRun = true;
}

[Fact]
[TestOrder(2)]
public void Two()
{
Assert.True(_testOneRun);
Assert.False(_testTwoRun);
Assert.False(_testThreeRun);
Assert.False(_testFourRun);

_testTwoRun = true;
}
}