11using System . Diagnostics . CodeAnalysis ;
22using Genbox . FastData . InternalShared ;
3- using Genbox . FastData . InternalShared . Helpers ;
43using Genbox . FastData . InternalShared . TestClasses ;
54using Genbox . FastData . InternalShared . TestHarness ;
65using Genbox . FastData . TestHarness . Runner . Code ;
98namespace Genbox . FastData . TestHarness . Runner ;
109
1110[ SuppressMessage ( "Usage" , "xUnit1039:The type argument to theory data is not compatible with the type of the corresponding test method parameter" ) ]
12- public class VectorTests
11+ public abstract class VectorTestsBase
1312{
13+ protected abstract ITestHarness Harness { get ; }
14+
1415 [ Theory ]
15- [ ClassData ( typeof ( KeyValueTestVectors ) ) ]
16- public async Task KeyValueVectors < TKey , TValue > ( ITestHarness harness , TestVector < TKey , TValue > vector ) where TValue : notnull
16+ [ ClassData ( typeof ( KeyValueVectorTheoryData ) ) ]
17+ public async Task KeyValueVectors < TKey , TValue > ( TestVector < TKey , TValue > vector ) where TValue : notnull
1718 {
18- TestHarnessRunnerHelper . SkipIfEmptyImplementation ( harness , vector . Type ) ;
19+ ITestHarness harness = Harness ;
1920 GeneratorSpec spec = Generate ( harness . CreateGenerator , vector ) ;
2021 Assert . NotEmpty ( spec . Source ) ;
2122
@@ -27,10 +28,10 @@ public async Task KeyValueVectors<TKey, TValue>(ITestHarness harness, TestVector
2728 }
2829
2930 [ Theory ]
30- [ ClassData ( typeof ( ValueTestVectors ) ) ]
31- public async Task ValueVectors < T > ( ITestHarness harness , TestVector < T > vector )
31+ [ ClassData ( typeof ( ValueVectorTheoryData ) ) ]
32+ public async Task ValueVectors < T > ( TestVector < T > vector )
3233 {
33- TestHarnessRunnerHelper . SkipIfEmptyImplementation ( harness , vector . Type ) ;
34+ ITestHarness harness = Harness ;
3435 GeneratorSpec spec = Generate ( harness . CreateGenerator , vector ) ;
3536 Assert . NotEmpty ( spec . Source ) ;
3637
@@ -40,14 +41,4 @@ public async Task ValueVectors<T>(ITestHarness harness, TestVector<T> vector)
4041 int exitCode = TestHarnessRunnerHelper . RunContainsProgram ( harness , spec , vector . Keys , vector . NotPresent , snapshotId ) ;
4142 TestHarnessRunnerHelper . AssertSuccessExitCode ( exitCode ) ;
4243 }
43-
44- private sealed class ValueTestVectors : HarnessVectorTheoryData
45- {
46- public ValueTestVectors ( ) => AddVectors ( TestVectorHelper . GetValueTestVectors ( ) . ToArray ( ) ) ;
47- }
48-
49- private sealed class KeyValueTestVectors : HarnessVectorTheoryData
50- {
51- public KeyValueTestVectors ( ) => AddVectors ( TestVectorHelper . GetKeyValueTestVectors ( ) . ToArray ( ) ) ;
52- }
5344}
0 commit comments