1
- using System . Collections . Generic ;
2
- using System . Linq ;
3
1
using FluentAssertions ;
4
2
using JetBrains . Annotations ;
5
3
using QsNet . Models ;
@@ -13,33 +11,27 @@ public class ExtensionTests
13
11
{
14
12
[ Theory ]
15
13
[ MemberData ( nameof ( GetEndToEndTestCases ) ) ]
16
- public void ToQueryString_ShouldEncodeEndToEndTestCases (
17
- Dictionary < string , object ? > data ,
18
- string expectedEncoded
19
- )
14
+ public void ToQueryString_ShouldEncodeEndToEndTestCases ( EndToEndTestCase testCase )
20
15
{
21
- data . ToQueryString ( new EncodeOptions { Encode = false } )
16
+ testCase . Data . ToQueryString ( new EncodeOptions { Encode = false } )
22
17
. Should ( )
23
- . Be ( expectedEncoded , $ "Failed for test case: { data } ") ;
18
+ . Be ( testCase . Encoded , $ "Failed for test case: { testCase . Data } ") ;
24
19
}
25
20
26
21
[ Theory ]
27
22
[ MemberData ( nameof ( GetEndToEndTestCases ) ) ]
28
- public void ToQueryMap_ShouldDecodeEndToEndTestCases (
29
- Dictionary < string , object ? > expectedData ,
30
- string encoded
31
- )
23
+ public void ToQueryMap_ShouldDecodeEndToEndTestCases ( EndToEndTestCase testCase )
32
24
{
33
- encoded
25
+ testCase . Encoded
34
26
. ToQueryMap ( )
35
27
. Should ( )
36
- . BeEquivalentTo ( expectedData , $ "Failed for test case: { encoded } ") ;
28
+ . BeEquivalentTo ( testCase . Data , $ "Failed for test case: { testCase . Encoded } ") ;
37
29
}
38
30
39
- public static IEnumerable < object [ ] > GetEndToEndTestCases ( )
31
+ public static TheoryData < EndToEndTestCase > GetEndToEndTestCases ( )
40
32
{
41
- return EndToEndTestCases . Cases . Select ( testCase =>
42
- ( object [ ] ) [ testCase . Data , testCase . Encoded ]
43
- ) ;
33
+ var data = new TheoryData < EndToEndTestCase > ( ) ;
34
+ foreach ( var testCase in EndToEndTestCases . Cases ) data . Add ( testCase ) ;
35
+ return data ;
44
36
}
45
37
}
0 commit comments