Fixing typos Dowload -> Download
This commit is contained in:
parent
01f7ecd9d9
commit
3866ee72e0
|
|
@ -24,7 +24,7 @@ namespace Microsoft.AspNetCore.Mvc.FunctionalTests
|
||||||
public async Task FileFromDisk_CanBeEnabled_WithMiddleware()
|
public async Task FileFromDisk_CanBeEnabled_WithMiddleware()
|
||||||
{
|
{
|
||||||
// Arrange & Act
|
// Arrange & Act
|
||||||
var response = await Client.GetAsync("http://localhost/DownloadFiles/DowloadFromDisk");
|
var response = await Client.GetAsync("http://localhost/DownloadFiles/DownloadFromDisk");
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
Assert.Equal(HttpStatusCode.OK, response.StatusCode);
|
Assert.Equal(HttpStatusCode.OK, response.StatusCode);
|
||||||
|
|
@ -43,7 +43,7 @@ namespace Microsoft.AspNetCore.Mvc.FunctionalTests
|
||||||
public async Task FileFromDisk_ReturnsFileWithFileName()
|
public async Task FileFromDisk_ReturnsFileWithFileName()
|
||||||
{
|
{
|
||||||
// Arrange & Act
|
// Arrange & Act
|
||||||
var response = await Client.GetAsync("http://localhost/DownloadFiles/DowloadFromDiskWithFileName");
|
var response = await Client.GetAsync("http://localhost/DownloadFiles/DownloadFromDiskWithFileName");
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
Assert.Equal(HttpStatusCode.OK, response.StatusCode);
|
Assert.Equal(HttpStatusCode.OK, response.StatusCode);
|
||||||
|
|
@ -64,7 +64,7 @@ namespace Microsoft.AspNetCore.Mvc.FunctionalTests
|
||||||
public async Task FileFromStream_ReturnsFile()
|
public async Task FileFromStream_ReturnsFile()
|
||||||
{
|
{
|
||||||
// Arrange & Act
|
// Arrange & Act
|
||||||
var response = await Client.GetAsync("http://localhost/DownloadFiles/DowloadFromStream");
|
var response = await Client.GetAsync("http://localhost/DownloadFiles/DownloadFromStream");
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
Assert.Equal(HttpStatusCode.OK, response.StatusCode);
|
Assert.Equal(HttpStatusCode.OK, response.StatusCode);
|
||||||
|
|
@ -81,7 +81,7 @@ namespace Microsoft.AspNetCore.Mvc.FunctionalTests
|
||||||
public async Task FileFromStream_ReturnsFileWithFileName()
|
public async Task FileFromStream_ReturnsFileWithFileName()
|
||||||
{
|
{
|
||||||
// Arrange & Act
|
// Arrange & Act
|
||||||
var response = await Client.GetAsync("http://localhost/DownloadFiles/DowloadFromStreamWithFileName");
|
var response = await Client.GetAsync("http://localhost/DownloadFiles/DownloadFromStreamWithFileName");
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
Assert.Equal(HttpStatusCode.OK, response.StatusCode);
|
Assert.Equal(HttpStatusCode.OK, response.StatusCode);
|
||||||
|
|
@ -102,7 +102,7 @@ namespace Microsoft.AspNetCore.Mvc.FunctionalTests
|
||||||
public async Task FileFromBinaryData_ReturnsFile()
|
public async Task FileFromBinaryData_ReturnsFile()
|
||||||
{
|
{
|
||||||
// Arrange & Act
|
// Arrange & Act
|
||||||
var response = await Client.GetAsync("http://localhost/DownloadFiles/DowloadFromBinaryData");
|
var response = await Client.GetAsync("http://localhost/DownloadFiles/DownloadFromBinaryData");
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
Assert.Equal(HttpStatusCode.OK, response.StatusCode);
|
Assert.Equal(HttpStatusCode.OK, response.StatusCode);
|
||||||
|
|
@ -119,7 +119,7 @@ namespace Microsoft.AspNetCore.Mvc.FunctionalTests
|
||||||
public async Task FileFromBinaryData_ReturnsFileWithFileName()
|
public async Task FileFromBinaryData_ReturnsFileWithFileName()
|
||||||
{
|
{
|
||||||
// Arrange & Act
|
// Arrange & Act
|
||||||
var response = await Client.GetAsync("http://localhost/DownloadFiles/DowloadFromBinaryDataWithFileName");
|
var response = await Client.GetAsync("http://localhost/DownloadFiles/DownloadFromBinaryDataWithFileName");
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
Assert.Equal(HttpStatusCode.OK, response.StatusCode);
|
Assert.Equal(HttpStatusCode.OK, response.StatusCode);
|
||||||
|
|
@ -160,4 +160,4 @@ namespace Microsoft.AspNetCore.Mvc.FunctionalTests
|
||||||
Assert.Equal("attachment; filename=downloadName.txt; filename*=UTF-8''downloadName.txt", contentDisposition);
|
Assert.Equal("attachment; filename=downloadName.txt; filename*=UTF-8''downloadName.txt", contentDisposition);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -17,19 +17,19 @@ namespace FilesWebSite
|
||||||
_hostingEnvironment = hostingEnvironment;
|
_hostingEnvironment = hostingEnvironment;
|
||||||
}
|
}
|
||||||
|
|
||||||
public IActionResult DowloadFromDisk()
|
public IActionResult DownloadFromDisk()
|
||||||
{
|
{
|
||||||
var path = Path.Combine(_hostingEnvironment.ContentRootPath, "sample.txt");
|
var path = Path.Combine(_hostingEnvironment.ContentRootPath, "sample.txt");
|
||||||
return PhysicalFile(path, "text/plain");
|
return PhysicalFile(path, "text/plain");
|
||||||
}
|
}
|
||||||
|
|
||||||
public IActionResult DowloadFromDiskWithFileName()
|
public IActionResult DownloadFromDiskWithFileName()
|
||||||
{
|
{
|
||||||
var path = Path.Combine(_hostingEnvironment.ContentRootPath, "sample.txt");
|
var path = Path.Combine(_hostingEnvironment.ContentRootPath, "sample.txt");
|
||||||
return PhysicalFile(path, "text/plain", "downloadName.txt");
|
return PhysicalFile(path, "text/plain", "downloadName.txt");
|
||||||
}
|
}
|
||||||
|
|
||||||
public IActionResult DowloadFromStream()
|
public IActionResult DownloadFromStream()
|
||||||
{
|
{
|
||||||
var stream = new MemoryStream();
|
var stream = new MemoryStream();
|
||||||
var writer = new StreamWriter(stream);
|
var writer = new StreamWriter(stream);
|
||||||
|
|
@ -40,7 +40,7 @@ namespace FilesWebSite
|
||||||
return File(stream, "text/plain");
|
return File(stream, "text/plain");
|
||||||
}
|
}
|
||||||
|
|
||||||
public IActionResult DowloadFromStreamWithFileName()
|
public IActionResult DownloadFromStreamWithFileName()
|
||||||
{
|
{
|
||||||
var stream = new MemoryStream();
|
var stream = new MemoryStream();
|
||||||
var writer = new StreamWriter(stream);
|
var writer = new StreamWriter(stream);
|
||||||
|
|
@ -51,16 +51,16 @@ namespace FilesWebSite
|
||||||
return File(stream, "text/plain", "downloadName.txt");
|
return File(stream, "text/plain", "downloadName.txt");
|
||||||
}
|
}
|
||||||
|
|
||||||
public IActionResult DowloadFromBinaryData()
|
public IActionResult DownloadFromBinaryData()
|
||||||
{
|
{
|
||||||
var data = Encoding.UTF8.GetBytes("This is a sample text from a binary array");
|
var data = Encoding.UTF8.GetBytes("This is a sample text from a binary array");
|
||||||
return File(data, "text/plain");
|
return File(data, "text/plain");
|
||||||
}
|
}
|
||||||
|
|
||||||
public IActionResult DowloadFromBinaryDataWithFileName()
|
public IActionResult DownloadFromBinaryDataWithFileName()
|
||||||
{
|
{
|
||||||
var data = Encoding.UTF8.GetBytes("This is a sample text from a binary array");
|
var data = Encoding.UTF8.GetBytes("This is a sample text from a binary array");
|
||||||
return File(data, "text/plain", "downloadName.txt");
|
return File(data, "text/plain", "downloadName.txt");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue