@@ -246,17 +246,21 @@ public async Task FileFromDisk_ReturnsFileWithFileName_IfRangeHeaderInvalid_Rang
246246 Assert . Equal ( "This is a sample text file" , body ) ;
247247 }
248248
249+ // Use int for HttpStatusCode data because xUnit cannot serialize a GAC'd enum when running on .NET Framework.
249250 [ Theory ]
250- [ InlineData ( "" , HttpStatusCode . OK , 26 ) ]
251- [ InlineData ( "bytes = 0-6" , HttpStatusCode . PartialContent , 7 ) ]
252- [ InlineData ( "bytes = 17-25" , HttpStatusCode . PartialContent , 9 ) ]
253- [ InlineData ( "bytes = 0-50" , HttpStatusCode . PartialContent , 26 ) ]
254- [ InlineData ( "0-6" , HttpStatusCode . OK , 26 ) ]
255- [ InlineData ( "bytes = " , HttpStatusCode . OK , 26 ) ]
256- [ InlineData ( "bytes = 1-4, 5-11" , HttpStatusCode . OK , 26 ) ]
257- [ InlineData ( "bytes = 35-36" , HttpStatusCode . RequestedRangeNotSatisfiable , 26 ) ]
258- [ InlineData ( "bytes = -0" , HttpStatusCode . RequestedRangeNotSatisfiable , 26 ) ]
259- public async Task FileFromDisk_ReturnsFileWithFileName_DoesNotServeBody_ForHeadRequest_WithLastModifiedAndEtag ( string rangeString , HttpStatusCode httpStatusCode , int expectedContentLength )
251+ [ InlineData ( "" , ( int ) HttpStatusCode . OK , 26 ) ]
252+ [ InlineData ( "bytes = 0-6" , ( int ) HttpStatusCode . PartialContent , 7 ) ]
253+ [ InlineData ( "bytes = 17-25" , ( int ) HttpStatusCode . PartialContent , 9 ) ]
254+ [ InlineData ( "bytes = 0-50" , ( int ) HttpStatusCode . PartialContent , 26 ) ]
255+ [ InlineData ( "0-6" , ( int ) HttpStatusCode . OK , 26 ) ]
256+ [ InlineData ( "bytes = " , ( int ) HttpStatusCode . OK , 26 ) ]
257+ [ InlineData ( "bytes = 1-4, 5-11" , ( int ) HttpStatusCode . OK , 26 ) ]
258+ [ InlineData ( "bytes = 35-36" , ( int ) HttpStatusCode . RequestedRangeNotSatisfiable , 26 ) ]
259+ [ InlineData ( "bytes = -0" , ( int ) HttpStatusCode . RequestedRangeNotSatisfiable , 26 ) ]
260+ public async Task FileFromDisk_ReturnsFileWithFileName_DoesNotServeBody_ForHeadRequest_WithLastModifiedAndEtag (
261+ string rangeString ,
262+ int httpStatusCode ,
263+ int expectedContentLength )
260264 {
261265 // Arrange
262266 var httpRequestMessage = new HttpRequestMessage ( HttpMethod . Head , "http://localhost/DownloadFiles/DownloadFromDiskWithFileName_WithLastModifiedAndEtag" ) ;
@@ -267,7 +271,7 @@ public async Task FileFromDisk_ReturnsFileWithFileName_DoesNotServeBody_ForHeadR
267271 var response = await Client . SendAsync ( httpRequestMessage ) ;
268272
269273 // Assert
270- Assert . Equal ( httpStatusCode , response . StatusCode ) ;
274+ Assert . Equal ( httpStatusCode , ( int ) response . StatusCode ) ;
271275
272276 Assert . NotNull ( response . Content . Headers . ContentType ) ;
273277 Assert . Equal ( "text/plain" , response . Content . Headers . ContentType . ToString ( ) ) ;
@@ -442,17 +446,21 @@ public async Task FileFromStream_ReturnsFileWithFileName_IfRangeHeaderInvalid_Ra
442446 Assert . Equal ( "This is sample text from a stream" , body ) ;
443447 }
444448
449+ // Use int for HttpStatusCode data because xUnit cannot serialize a GAC'd enum when running on .NET Framework.
445450 [ Theory ]
446- [ InlineData ( "" , HttpStatusCode . OK , 33 ) ]
447- [ InlineData ( "bytes = 0-6" , HttpStatusCode . PartialContent , 7 ) ]
448- [ InlineData ( "bytes = 17-25" , HttpStatusCode . PartialContent , 9 ) ]
449- [ InlineData ( "bytes = 0-50" , HttpStatusCode . PartialContent , 33 ) ]
450- [ InlineData ( "0-6" , HttpStatusCode . OK , 33 ) ]
451- [ InlineData ( "bytes = " , HttpStatusCode . OK , 33 ) ]
452- [ InlineData ( "bytes = 1-4, 5-11" , HttpStatusCode . OK , 33 ) ]
453- [ InlineData ( "bytes = 35-36" , HttpStatusCode . RequestedRangeNotSatisfiable , 33 ) ]
454- [ InlineData ( "bytes = -0" , HttpStatusCode . RequestedRangeNotSatisfiable , 33 ) ]
455- public async Task FileFromStream_ReturnsFileWithFileName_DoesNotServeBody_ForHeadRequest ( string rangeString , HttpStatusCode httpStatusCode , int expectedContentLength )
451+ [ InlineData ( "" , ( int ) HttpStatusCode . OK , 33 ) ]
452+ [ InlineData ( "bytes = 0-6" , ( int ) HttpStatusCode . PartialContent , 7 ) ]
453+ [ InlineData ( "bytes = 17-25" , ( int ) HttpStatusCode . PartialContent , 9 ) ]
454+ [ InlineData ( "bytes = 0-50" , ( int ) HttpStatusCode . PartialContent , 33 ) ]
455+ [ InlineData ( "0-6" , ( int ) HttpStatusCode . OK , 33 ) ]
456+ [ InlineData ( "bytes = " , ( int ) HttpStatusCode . OK , 33 ) ]
457+ [ InlineData ( "bytes = 1-4, 5-11" , ( int ) HttpStatusCode . OK , 33 ) ]
458+ [ InlineData ( "bytes = 35-36" , ( int ) HttpStatusCode . RequestedRangeNotSatisfiable , 33 ) ]
459+ [ InlineData ( "bytes = -0" , ( int ) HttpStatusCode . RequestedRangeNotSatisfiable , 33 ) ]
460+ public async Task FileFromStream_ReturnsFileWithFileName_DoesNotServeBody_ForHeadRequest (
461+ string rangeString ,
462+ int httpStatusCode ,
463+ int expectedContentLength )
456464 {
457465 // Arrange
458466 var httpRequestMessage = new HttpRequestMessage ( HttpMethod . Head , "http://localhost/DownloadFiles/DownloadFromStreamWithFileName_WithEtag" ) ;
@@ -463,7 +471,7 @@ public async Task FileFromStream_ReturnsFileWithFileName_DoesNotServeBody_ForHea
463471 var response = await Client . SendAsync ( httpRequestMessage ) ;
464472
465473 // Assert
466- Assert . Equal ( httpStatusCode , response . StatusCode ) ;
474+ Assert . Equal ( httpStatusCode , ( int ) response . StatusCode ) ;
467475
468476 Assert . NotNull ( response . Content . Headers . ContentType ) ;
469477 Assert . Equal ( "text/plain" , response . Content . Headers . ContentType . ToString ( ) ) ;
@@ -616,7 +624,7 @@ public async Task FileFromBinaryData_ReturnsFileWithFileName_IfRangeHeaderValid(
616624 var response = await Client . SendAsync ( httpRequestMessage ) ;
617625 var body = await response . Content . ReadAsStringAsync ( ) ;
618626
619- // Assert
627+ // Assert
620628 Assert . NotNull ( response . Content . Headers . ContentType ) ;
621629 Assert . Equal ( "text/plain" , response . Content . Headers . ContentType . ToString ( ) ) ;
622630 Assert . NotNull ( body ) ;
@@ -643,17 +651,21 @@ public async Task FileFromBinaryData_ReturnsFileWithFileName_IfRangeHeaderInvali
643651 Assert . Equal ( "This is a sample text from a binary array" , body ) ;
644652 }
645653
654+ // Use int for HttpStatusCode data because xUnit cannot serialize a GAC'd enum when running on .NET Framework.
646655 [ Theory ]
647- [ InlineData ( "" , HttpStatusCode . OK , 41 ) ]
648- [ InlineData ( "bytes = 0-6" , HttpStatusCode . PartialContent , 7 ) ]
649- [ InlineData ( "bytes = 17-25" , HttpStatusCode . PartialContent , 9 ) ]
650- [ InlineData ( "bytes = 0-50" , HttpStatusCode . PartialContent , 41 ) ]
651- [ InlineData ( "0-6" , HttpStatusCode . OK , 41 ) ]
652- [ InlineData ( "bytes = " , HttpStatusCode . OK , 41 ) ]
653- [ InlineData ( "bytes = 1-4, 5-11" , HttpStatusCode . OK , 41 ) ]
654- [ InlineData ( "bytes = 45-46" , HttpStatusCode . RequestedRangeNotSatisfiable , 41 ) ]
655- [ InlineData ( "bytes = -0" , HttpStatusCode . RequestedRangeNotSatisfiable , 41 ) ]
656- public async Task FileFromBinaryData_ReturnsFileWithFileName_DoesNotServeBody_ForHeadRequest ( string rangeString , HttpStatusCode httpStatusCode , int expectedContentLength )
656+ [ InlineData ( "" , ( int ) HttpStatusCode . OK , 41 ) ]
657+ [ InlineData ( "bytes = 0-6" , ( int ) HttpStatusCode . PartialContent , 7 ) ]
658+ [ InlineData ( "bytes = 17-25" , ( int ) HttpStatusCode . PartialContent , 9 ) ]
659+ [ InlineData ( "bytes = 0-50" , ( int ) HttpStatusCode . PartialContent , 41 ) ]
660+ [ InlineData ( "0-6" , ( int ) HttpStatusCode . OK , 41 ) ]
661+ [ InlineData ( "bytes = " , ( int ) HttpStatusCode . OK , 41 ) ]
662+ [ InlineData ( "bytes = 1-4, 5-11" , ( int ) HttpStatusCode . OK , 41 ) ]
663+ [ InlineData ( "bytes = 45-46" , ( int ) HttpStatusCode . RequestedRangeNotSatisfiable , 41 ) ]
664+ [ InlineData ( "bytes = -0" , ( int ) HttpStatusCode . RequestedRangeNotSatisfiable , 41 ) ]
665+ public async Task FileFromBinaryData_ReturnsFileWithFileName_DoesNotServeBody_ForHeadRequest (
666+ string rangeString ,
667+ int httpStatusCode ,
668+ int expectedContentLength )
657669 {
658670 // Arrange
659671 var httpRequestMessage = new HttpRequestMessage ( HttpMethod . Head , "http://localhost/DownloadFiles/DownloadFromBinaryDataWithFileName_WithEtag" ) ;
@@ -664,7 +676,7 @@ public async Task FileFromBinaryData_ReturnsFileWithFileName_DoesNotServeBody_Fo
664676 var response = await Client . SendAsync ( httpRequestMessage ) ;
665677
666678 // Assert
667- Assert . Equal ( httpStatusCode , response . StatusCode ) ;
679+ Assert . Equal ( httpStatusCode , ( int ) response . StatusCode ) ;
668680
669681 Assert . NotNull ( response . Content . Headers . ContentType ) ;
670682 Assert . Equal ( "text/plain" , response . Content . Headers . ContentType . ToString ( ) ) ;
@@ -842,17 +854,21 @@ public async Task FileFromEmbeddedResources_ReturnsFileWithFileName_RangeRequest
842854 Assert . Equal ( "attachment; filename=downloadName.txt; filename*=UTF-8''downloadName.txt" , contentDisposition ) ;
843855 }
844856
857+ // Use int for HttpStatusCode data because xUnit cannot serialize a GAC'd enum when running on .NET Framework.
845858 [ Theory ]
846- [ InlineData ( "" , HttpStatusCode . OK , 38 ) ]
847- [ InlineData ( "bytes = 0-6" , HttpStatusCode . PartialContent , 7 ) ]
848- [ InlineData ( "bytes = 17-25" , HttpStatusCode . PartialContent , 9 ) ]
849- [ InlineData ( "bytes = 0-50" , HttpStatusCode . PartialContent , 38 ) ]
850- [ InlineData ( "0-6" , HttpStatusCode . OK , 38 ) ]
851- [ InlineData ( "bytes = " , HttpStatusCode . OK , 38 ) ]
852- [ InlineData ( "bytes = 1-4, 5-11" , HttpStatusCode . OK , 38 ) ]
853- [ InlineData ( "bytes = 45-46" , HttpStatusCode . RequestedRangeNotSatisfiable , 38 ) ]
854- [ InlineData ( "bytes = -0" , HttpStatusCode . RequestedRangeNotSatisfiable , 38 ) ]
855- public async Task FileFromEmbeddedResources_ReturnsFileWithFileName_DoesNotServeBody_ForHeadRequest ( string rangeString , HttpStatusCode httpStatusCode , int expectedContentLength )
859+ [ InlineData ( "" , ( int ) HttpStatusCode . OK , 38 ) ]
860+ [ InlineData ( "bytes = 0-6" , ( int ) HttpStatusCode . PartialContent , 7 ) ]
861+ [ InlineData ( "bytes = 17-25" , ( int ) HttpStatusCode . PartialContent , 9 ) ]
862+ [ InlineData ( "bytes = 0-50" , ( int ) HttpStatusCode . PartialContent , 38 ) ]
863+ [ InlineData ( "0-6" , ( int ) HttpStatusCode . OK , 38 ) ]
864+ [ InlineData ( "bytes = " , ( int ) HttpStatusCode . OK , 38 ) ]
865+ [ InlineData ( "bytes = 1-4, 5-11" , ( int ) HttpStatusCode . OK , 38 ) ]
866+ [ InlineData ( "bytes = 45-46" , ( int ) HttpStatusCode . RequestedRangeNotSatisfiable , 38 ) ]
867+ [ InlineData ( "bytes = -0" , ( int ) HttpStatusCode . RequestedRangeNotSatisfiable , 38 ) ]
868+ public async Task FileFromEmbeddedResources_ReturnsFileWithFileName_DoesNotServeBody_ForHeadRequest (
869+ string rangeString ,
870+ int httpStatusCode ,
871+ int expectedContentLength )
856872 {
857873 // Arrange
858874 var httpRequestMessage = new HttpRequestMessage ( HttpMethod . Head , "http://localhost/EmbeddedFiles/DownloadFileWithFileName" ) ;
@@ -863,7 +879,7 @@ public async Task FileFromEmbeddedResources_ReturnsFileWithFileName_DoesNotServe
863879 var response = await Client . SendAsync ( httpRequestMessage ) ;
864880
865881 // Assert
866- Assert . Equal ( httpStatusCode , response . StatusCode ) ;
882+ Assert . Equal ( httpStatusCode , ( int ) response . StatusCode ) ;
867883
868884 Assert . NotNull ( response . Content . Headers . ContentType ) ;
869885 Assert . Equal ( "text/plain" , response . Content . Headers . ContentType . ToString ( ) ) ;
0 commit comments