@@ -12,9 +12,8 @@ namespace Tests.Connection.MetaData
12
12
{
13
13
public class MetaHeaderProviderTests
14
14
{
15
- private readonly Regex _validHeaderRegex = new Regex ( @"^[a-z]{1,}=[a-z0-9\.\-]{1,}(?:,[a-z]{1,}=[a-z0-9\.\-]+)*$" ) ;
16
- private readonly Regex _validVersionRegex = new Regex ( @"^[0-9]{1,2}\.[0-9]{1,2}(?:\.[0-9]{1,3})?p?$" ) ;
17
- private readonly Regex _validHttpClientPart = new Regex ( @"^[a-z]{2,3}=[0-9]{1,2}\.[0-9]{1,2}(?:\.[0-9]{1,3})?p?$" ) ;
15
+ private readonly Regex _validHeaderRegex = new ( @"^[a-z]{1,}=[a-z0-9\.\-]{1,}(?:,[a-z]{1,}=[a-z0-9\.\-]+)*$" ) ;
16
+ private readonly Regex _validVersionRegex = new ( @"^[0-9]{1,2}\.[0-9]{1,2}(?:\.[0-9]{1,3})?p?$" ) ;
18
17
19
18
[ U ] public void HeaderName_ReturnsExpectedValue ( )
20
19
{
@@ -54,19 +53,25 @@ [U] public void HeaderName_ReturnsExpectedValue_ForSyncRequest_WhenNotDisabled()
54
53
_validHeaderRegex . Match ( result ) . Success . Should ( ) . BeTrue ( ) ;
55
54
56
55
var parts = result . Split ( ',' ) ;
57
- parts . Length . Should ( ) . Be ( 4 ) ;
56
+ parts . Length . Should ( ) . Be ( 5 ) ;
58
57
59
58
parts [ 0 ] . Should ( ) . StartWith ( "es=" ) ;
60
59
var clientVersion = parts [ 0 ] . Substring ( 3 ) ;
61
60
_validVersionRegex . Match ( clientVersion ) . Success . Should ( ) . BeTrue ( ) ;
62
61
63
- parts [ 1 ] . Should ( ) . Be ( "a=0" ) ;
64
-
65
- parts [ 2 ] . Should ( ) . StartWith ( "net=" ) ;
66
- var runtimeVersion = parts [ 2 ] . Substring ( 4 ) ;
62
+ parts [ 1 ] . Should ( ) . StartWith ( "net=" ) ;
63
+ var runtimeVersion = parts [ 1 ] . Substring ( 4 ) ;
67
64
_validVersionRegex . Match ( runtimeVersion ) . Success . Should ( ) . BeTrue ( ) ;
68
65
69
- _validHttpClientPart . Match ( parts [ 3 ] ) . Success . Should ( ) . BeTrue ( ) ;
66
+ parts [ 2 ] . Should ( ) . StartWith ( "t=" ) ;
67
+ clientVersion = parts [ 2 ] . Substring ( 2 ) ;
68
+ _validVersionRegex . Match ( clientVersion ) . Success . Should ( ) . BeTrue ( ) ;
69
+
70
+ parts [ 3 ] . Should ( ) . Be ( "a=0" ) ;
71
+
72
+ parts [ 4 ] . Should ( ) . StartWith ( "so=" ) ;
73
+ var socketVersion = parts [ 4 ] . Substring ( 3 ) ;
74
+ _validVersionRegex . Match ( socketVersion ) . Success . Should ( ) . BeTrue ( ) ;
70
75
}
71
76
72
77
[ U ] public void HeaderName_ReturnsExpectedValue_ForAsyncRequest_WhenNotDisabled ( )
@@ -87,19 +92,25 @@ [U] public void HeaderName_ReturnsExpectedValue_ForAsyncRequest_WhenNotDisabled(
87
92
_validHeaderRegex . Match ( result ) . Success . Should ( ) . BeTrue ( ) ;
88
93
89
94
var parts = result . Split ( ',' ) ;
90
- parts . Length . Should ( ) . Be ( 4 ) ;
95
+ parts . Length . Should ( ) . Be ( 5 ) ;
91
96
92
97
parts [ 0 ] . Should ( ) . StartWith ( "es=" ) ;
93
98
var clientVersion = parts [ 0 ] . Substring ( 3 ) ;
94
99
_validVersionRegex . Match ( clientVersion ) . Success . Should ( ) . BeTrue ( ) ;
95
100
96
- parts [ 1 ] . Should ( ) . Be ( "a=1" ) ;
97
-
98
- parts [ 2 ] . Should ( ) . StartWith ( "net=" ) ;
101
+ parts [ 1 ] . Should ( ) . StartWith ( "net=" ) ;
99
102
var runtimeVersion = parts [ 2 ] . Substring ( 4 ) ;
100
103
_validVersionRegex . Match ( runtimeVersion ) . Success . Should ( ) . BeTrue ( ) ;
101
104
102
- _validHttpClientPart . Match ( parts [ 3 ] ) . Success . Should ( ) . BeTrue ( ) ;
105
+ parts [ 2 ] . Should ( ) . StartWith ( "t=" ) ;
106
+ clientVersion = parts [ 2 ] . Substring ( 2 ) ;
107
+ _validVersionRegex . Match ( clientVersion ) . Success . Should ( ) . BeTrue ( ) ;
108
+
109
+ parts [ 3 ] . Should ( ) . Be ( "a=1" ) ;
110
+
111
+ parts [ 4 ] . Should ( ) . StartWith ( "so=" ) ;
112
+ var socketVersion = parts [ 4 ] . Substring ( 3 ) ;
113
+ _validVersionRegex . Match ( socketVersion ) . Success . Should ( ) . BeTrue ( ) ;
103
114
}
104
115
}
105
116
}
0 commit comments