diff --git a/src/RapidIntegrationTesting.xUnit/RapidIntegrationTesting.xUnit.xml b/src/RapidIntegrationTesting.xUnit/RapidIntegrationTesting.xUnit.xml index 7e9b47b..a5e57cf 100644 --- a/src/RapidIntegrationTesting.xUnit/RapidIntegrationTesting.xUnit.xml +++ b/src/RapidIntegrationTesting.xUnit/RapidIntegrationTesting.xUnit.xml @@ -23,7 +23,7 @@ Handels the correct ordering of test cases marked with - To register it, use the XUnit attribute: [TestCaseOrderer(nameof(TestOrderer), TestOrderer.AssemblyName)] + To register it, use the XUnit attribute: [TestOrderer.TypeName, TestOrderer.AssemblyName)] diff --git a/src/RapidIntegrationTesting.xUnit/TestOrderer.cs b/src/RapidIntegrationTesting.xUnit/TestOrderer.cs index bab5b2a..3876e2f 100644 --- a/src/RapidIntegrationTesting.xUnit/TestOrderer.cs +++ b/src/RapidIntegrationTesting.xUnit/TestOrderer.cs @@ -5,19 +5,19 @@ namespace RapidIntegrationTesting.xUnit; /// /// Handels the correct ordering of test cases marked with -/// To register it, use the XUnit attribute: [TestCaseOrderer(nameof(TestOrderer), TestOrderer.AssemblyName)] +/// To register it, use the XUnit attribute: [TestOrderer.TypeName, TestOrderer.AssemblyName)] /// public class TestOrderer : ITestCaseOrderer { /// /// Type name of the . Used in the XUnit attribute "TestCaseOrderer" /// - public const string TypeName = "Testing.Utility.TestOrderer"; + public const string TypeName = "RapidIntegrationTesting.xUnit.TestOrderer"; /// /// Assembly name of the . Used in the XUnit attribute "TestCaseOrderer" /// - public const string AssemblyName = "Testing.Utility"; + public const string AssemblyName = "RapidIntegrationTesting.xUnit"; private readonly IMessageSink _diagnosticMessageSink; diff --git a/test/RapidIntegrationTesting.Integration.Tests/Tests/TestOrdererTests.cs b/test/RapidIntegrationTesting.Integration.Tests/Tests/TestOrdererTests.cs new file mode 100644 index 0000000..ef5b8a0 --- /dev/null +++ b/test/RapidIntegrationTesting.Integration.Tests/Tests/TestOrdererTests.cs @@ -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; + } +} \ No newline at end of file