@@ -47,55 +47,29 @@ public Http1HttpProtocolFeatureCollectionTests()
4747 }
4848
4949 [ Fact ]
50- public int FeaturesStartAsSelf ( )
50+ public void FeaturesStartAsSelf ( )
5151 {
52- var featureCount = 0 ;
53- foreach ( var featureIter in _collection )
54- {
55- Type type = featureIter . Key ;
56- if ( type . IsAssignableFrom ( typeof ( HttpProtocol ) ) )
57- {
58- var featureLookup = _collection [ type ] ;
59- Assert . Same ( featureLookup , featureIter . Value ) ;
60- Assert . Same ( featureLookup , _collection ) ;
61- featureCount ++ ;
62- }
63- }
52+ var featureCount = GetFeaturesCount ( ) ;
6453
6554 Assert . NotEqual ( 0 , featureCount ) ;
66-
67- return featureCount ;
6855 }
6956
7057 [ Fact ]
71- public int FeaturesCanBeAssignedTo ( )
58+ public void FeaturesCanBeAssignedTo ( )
7259 {
7360 var featureCount = SetFeaturesToNonDefault ( ) ;
7461 Assert . NotEqual ( 0 , featureCount ) ;
7562
76- featureCount = 0 ;
77- foreach ( var feature in _collection )
78- {
79- Type type = feature . Key ;
80- if ( type . IsAssignableFrom ( typeof ( HttpProtocol ) ) )
81- {
82- Assert . Same ( _collection [ type ] , feature . Value ) ;
83- Assert . NotSame ( _collection [ type ] , _collection ) ;
84- featureCount ++ ;
85- }
86- }
87-
63+ featureCount = GetFeaturesCount ( ) ;
8864 Assert . NotEqual ( 0 , featureCount ) ;
89-
90- return featureCount ;
9165 }
9266
9367 [ Fact ]
9468 public void FeaturesResetToSelf ( )
9569 {
9670 var featuresAssigned = SetFeaturesToNonDefault ( ) ;
9771 _http1Connection . ResetFeatureCollection ( ) ;
98- var featuresReset = FeaturesStartAsSelf ( ) ;
72+ var featuresReset = GetFeaturesCount ( ) ;
9973
10074 Assert . Equal ( featuresAssigned , featuresReset ) ;
10175 }
@@ -108,7 +82,7 @@ public void FeaturesByGenericSameAsByType()
10882 CompareGenericGetterToIndexer ( ) ;
10983
11084 _http1Connection . ResetFeatureCollection ( ) ;
111- var featuresReset = FeaturesStartAsSelf ( ) ;
85+ var featuresReset = GetFeaturesCount ( ) ;
11286
11387 Assert . Equal ( featuresAssigned , featuresReset ) ;
11488 }
@@ -235,6 +209,23 @@ private int EachHttpProtocolFeatureSetAndUnique()
235209 return featureCount ;
236210 }
237211
212+ public int GetFeaturesCount ( )
213+ {
214+ var featureCount = 0 ;
215+ foreach ( var featureIter in _collection )
216+ {
217+ Type type = featureIter . Key ;
218+ if ( type . IsAssignableFrom ( typeof ( HttpProtocol ) ) )
219+ {
220+ var featureLookup = _collection [ type ] ;
221+ Assert . Same ( featureLookup , featureIter . Value ) ;
222+ Assert . Same ( featureLookup , _collection ) ;
223+ featureCount ++ ;
224+ }
225+ }
226+ return featureCount ;
227+ }
228+
238229 private int SetFeaturesToNonDefault ( )
239230 {
240231 int featureCount = 0 ;
0 commit comments