diff --git a/test/Microsoft.AspNet.Mvc.IntegrationTests/FormCollectionModelBindingIntegrationTest.cs b/test/Microsoft.AspNet.Mvc.IntegrationTests/FormCollectionModelBindingIntegrationTest.cs index 047630d9ba..16b46aa2a8 100644 --- a/test/Microsoft.AspNet.Mvc.IntegrationTests/FormCollectionModelBindingIntegrationTest.cs +++ b/test/Microsoft.AspNet.Mvc.IntegrationTests/FormCollectionModelBindingIntegrationTest.cs @@ -161,14 +161,15 @@ namespace Microsoft.AspNet.Mvc.IntegrationTests private void UpdateRequest(HttpRequest request, string data, string name) { + const string fileName = "text.txt"; var fileCollection = new FormFileCollection(); var formCollection = new FormCollection(new Dictionary(), fileCollection); var memoryStream = new MemoryStream(Encoding.UTF8.GetBytes(data)); request.Form = formCollection; request.ContentType = "multipart/form-data; boundary=----WebKitFormBoundarymx2fSWqWSd0OxQqq"; - request.Headers["Content-Disposition"] = "form-data; name=" + name + "; filename=text.txt"; - fileCollection.Add(new FormFile(memoryStream, 0, data.Length) + request.Headers["Content-Disposition"] = $"form-data; name={name}; filename={fileName}"; + fileCollection.Add(new FormFile(memoryStream, 0, data.Length, name, fileName) { Headers = request.Headers }); diff --git a/test/Microsoft.AspNet.Mvc.IntegrationTests/FormFileModelBindingIntegrationTest.cs b/test/Microsoft.AspNet.Mvc.IntegrationTests/FormFileModelBindingIntegrationTest.cs index 64f66a3815..407d00a7e1 100644 --- a/test/Microsoft.AspNet.Mvc.IntegrationTests/FormFileModelBindingIntegrationTest.cs +++ b/test/Microsoft.AspNet.Mvc.IntegrationTests/FormFileModelBindingIntegrationTest.cs @@ -161,6 +161,7 @@ namespace Microsoft.AspNet.Mvc.IntegrationTests private void UpdateRequest(HttpRequest request, string data, string name) { + const string fileName = "text.txt"; var fileCollection = new FormFileCollection(); var formCollection = new FormCollection(new Dictionary(), fileCollection); @@ -173,10 +174,10 @@ namespace Microsoft.AspNet.Mvc.IntegrationTests return; } - request.Headers["Content-Disposition"] = "form-data; name=" + name + "; filename=text.txt"; + request.Headers["Content-Disposition"] = $"form-data; name={name}; filename={fileName}"; var memoryStream = new MemoryStream(Encoding.UTF8.GetBytes(data)); - fileCollection.Add(new FormFile(memoryStream, 0, data.Length) + fileCollection.Add(new FormFile(memoryStream, 0, data.Length, name, fileName) { Headers = request.Headers }); diff --git a/test/Microsoft.AspNet.Mvc.IntegrationTests/MutableObjectModelBinderIntegrationTest.cs b/test/Microsoft.AspNet.Mvc.IntegrationTests/MutableObjectModelBinderIntegrationTest.cs index 95fb22806e..972e6bb8d3 100644 --- a/test/Microsoft.AspNet.Mvc.IntegrationTests/MutableObjectModelBinderIntegrationTest.cs +++ b/test/Microsoft.AspNet.Mvc.IntegrationTests/MutableObjectModelBinderIntegrationTest.cs @@ -1954,15 +1954,16 @@ namespace Microsoft.AspNet.Mvc.IntegrationTests private static void SetFormFileBodyContent(HttpRequest request, string content, string name) { + const string fileName = "text.txt"; var fileCollection = new FormFileCollection(); var formCollection = new FormCollection(new Dictionary(), fileCollection); var memoryStream = new MemoryStream(Encoding.UTF8.GetBytes(content)); request.Form = formCollection; request.ContentType = "multipart/form-data; boundary=----WebKitFormBoundarymx2fSWqWSd0OxQqq"; - request.Headers["Content-Disposition"] = "form-data; name=" + name + "; filename=text.txt"; + request.Headers["Content-Disposition"] = $"form-data; name={name}; filename={fileName}"; - fileCollection.Add(new FormFile(memoryStream, 0, memoryStream.Length) + fileCollection.Add(new FormFile(memoryStream, 0, memoryStream.Length, name, fileName) { Headers = request.Headers });