@@ -53,9 +53,11 @@ public FileChunkStartsWithBOM()
5353 [ Fact ]
5454 public void CanHandleBOM ( )
5555 {
56- using ( Stream stream = TestUtil . StringToStream ( _testCase . Request , Encoding . UTF8 ) )
56+ var encoding = Encoding . UTF8 ;
57+
58+ using ( Stream stream = TestUtil . StringToStream ( _testCase . Request , encoding ) )
5759 {
58- var parser = MultipartFormDataParser . Parse ( stream , Encoding . UTF8 , _binaryBufferSize ) ;
60+ var parser = MultipartFormDataParser . Parse ( stream , encoding , _binaryBufferSize ) ;
5961
6062 using ( var file = parser . Files [ 0 ] . Data )
6163 {
@@ -65,21 +67,21 @@ public void CanHandleBOM()
6567 var paddingBuffer = new byte [ _padding . Length ] ;
6668 var readCount = file . Read ( paddingBuffer , 0 , paddingBuffer . Length ) ;
6769
68- Assert . Equal ( _padding , Encoding . UTF8 . GetString ( paddingBuffer ) ) ;
70+ Assert . Equal ( _padding , encoding . GetString ( paddingBuffer ) ) ;
6971
7072 // Read the BOM and assert we get the expected value
7173 var bomBuffer = new byte [ _utf8BOMBinary . Length ] ;
7274 readCount = file . Read ( bomBuffer , 0 , bomBuffer . Length ) ;
7375
7476 // If this assertion fails, it means that we have reproduced the problem described in GH-64
7577 // If it succeeds, it means that the bug has been fixed.
76- Assert . Equal ( _utf8BOMString , Encoding . UTF8 . GetString ( bomBuffer ) ) ;
78+ Assert . Equal ( _utf8BOMString , encoding . GetString ( bomBuffer ) ) ;
7779
7880 // Read the rest of the content and assert we get the expected value
7981 var restOfContentBuffer = new byte [ _fileContent . Length - _padding . Length - _utf8BOMString . Length ] ;
8082 readCount = file . Read ( restOfContentBuffer , 0 , restOfContentBuffer . Length ) ;
8183
82- Assert . Equal ( "Hello world" , Encoding . UTF8 . GetString ( restOfContentBuffer ) ) ;
84+ Assert . Equal ( "Hello world" , encoding . GetString ( restOfContentBuffer ) ) ;
8385 }
8486 }
8587 }
0 commit comments