File tree Expand file tree Collapse file tree
tests/Testcontainers.Xunit.Tests Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ namespace Testcontainers . Xunit . Tests ;
2+
3+ public class AlphabeticalTestCaseOrderer : ITestCaseOrderer
4+ {
5+ public IEnumerable < TTestCase > OrderTestCases < TTestCase > ( IEnumerable < TTestCase > testCases ) where TTestCase : ITestCase
6+ {
7+ return testCases . OrderBy ( testCase => testCase . TestMethod . Method . Name ) ;
8+ }
9+ }
Original file line number Diff line number Diff line change @@ -12,7 +12,8 @@ protected override RedisBuilder Configure(RedisBuilder builder)
1212}
1313// # --8<-- [end:ConfigureRedisContainer]
1414
15- public sealed partial class RedisContainerTest : ITestCaseOrderer
15+ [ TestCaseOrderer ( ordererTypeName : "Testcontainers.Xunit.Tests.AlphabeticalTestCaseOrderer" , ordererAssemblyName : "Testcontainers.Xunit.Tests" ) ]
16+ public sealed partial class RedisContainerTest
1617{
1718 [ Fact ]
1819 public void ImageShouldMatchDefaultModuleImage ( )
@@ -41,9 +42,4 @@ public async Task Test2()
4142 // 👇 The created and started container is disposed of after this method (test) completes.
4243 }
4344 // # --8<-- [end:RunTests]
44-
45- public IEnumerable < TTestCase > OrderTestCases < TTestCase > ( IEnumerable < TTestCase > testCases ) where TTestCase : ITestCase
46- {
47- return testCases . OrderBy ( testCase => testCase . TestMethod . Method . Name ) ;
48- }
4945}
Original file line number Diff line number Diff line change @@ -17,7 +17,8 @@ public sealed partial class RedisContainerTest(RedisContainerFixture fixture)
1717 : IClassFixture < RedisContainerFixture > ;
1818// # --8<-- [end:InjectContainerFixture]
1919
20- public sealed partial class RedisContainerTest : ITestCaseOrderer
20+ [ TestCaseOrderer ( ordererTypeName : "Testcontainers.Xunit.Tests.AlphabeticalTestCaseOrderer" , ordererAssemblyName : "Testcontainers.Xunit.Tests" ) ]
21+ public sealed partial class RedisContainerTest
2122{
2223 [ Fact ]
2324 public void ImageShouldMatchDefaultModuleImage ( )
@@ -42,9 +43,4 @@ public async Task Test2()
4243 Assert . Equal ( "value" , redisValue ) ;
4344 }
4445 // # --8<-- [end:RunTests]
45-
46- public IEnumerable < TTestCase > OrderTestCases < TTestCase > ( IEnumerable < TTestCase > testCases ) where TTestCase : ITestCase
47- {
48- return testCases . OrderBy ( testCase => testCase . TestMethod . Method . Name ) ;
49- }
5046}
You can’t perform that action at this time.
0 commit comments