@@ -12,9 +12,8 @@ namespace Tests.Connection.MetaData
1212{
1313 public class MetaHeaderProviderTests
1414 {
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?$" ) ;
1817
1918 [ U ] public void HeaderName_ReturnsExpectedValue ( )
2019 {
@@ -54,19 +53,25 @@ [U] public void HeaderName_ReturnsExpectedValue_ForSyncRequest_WhenNotDisabled()
5453 _validHeaderRegex . Match ( result ) . Success . Should ( ) . BeTrue ( ) ;
5554
5655 var parts = result . Split ( ',' ) ;
57- parts . Length . Should ( ) . Be ( 4 ) ;
56+ parts . Length . Should ( ) . Be ( 5 ) ;
5857
5958 parts [ 0 ] . Should ( ) . StartWith ( "es=" ) ;
6059 var clientVersion = parts [ 0 ] . Substring ( 3 ) ;
6160 _validVersionRegex . Match ( clientVersion ) . Success . Should ( ) . BeTrue ( ) ;
6261
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 ) ;
6764 _validVersionRegex . Match ( runtimeVersion ) . Success . Should ( ) . BeTrue ( ) ;
6865
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 ( ) ;
7075 }
7176
7277 [ U ] public void HeaderName_ReturnsExpectedValue_ForAsyncRequest_WhenNotDisabled ( )
@@ -87,19 +92,25 @@ [U] public void HeaderName_ReturnsExpectedValue_ForAsyncRequest_WhenNotDisabled(
8792 _validHeaderRegex . Match ( result ) . Success . Should ( ) . BeTrue ( ) ;
8893
8994 var parts = result . Split ( ',' ) ;
90- parts . Length . Should ( ) . Be ( 4 ) ;
95+ parts . Length . Should ( ) . Be ( 5 ) ;
9196
9297 parts [ 0 ] . Should ( ) . StartWith ( "es=" ) ;
9398 var clientVersion = parts [ 0 ] . Substring ( 3 ) ;
9499 _validVersionRegex . Match ( clientVersion ) . Success . Should ( ) . BeTrue ( ) ;
95100
96- parts [ 1 ] . Should ( ) . Be ( "a=1" ) ;
97-
98- parts [ 2 ] . Should ( ) . StartWith ( "net=" ) ;
101+ parts [ 1 ] . Should ( ) . StartWith ( "net=" ) ;
99102 var runtimeVersion = parts [ 2 ] . Substring ( 4 ) ;
100103 _validVersionRegex . Match ( runtimeVersion ) . Success . Should ( ) . BeTrue ( ) ;
101104
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 ( ) ;
103114 }
104115 }
105116}
0 commit comments