Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/dotnet/aspnetcore.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'src/Http/Http.Results/test/NotFoundObjectResultTest.cs')
-rw-r--r--src/Http/Http.Results/test/NotFoundObjectResultTest.cs87
1 files changed, 43 insertions, 44 deletions
diff --git a/src/Http/Http.Results/test/NotFoundObjectResultTest.cs b/src/Http/Http.Results/test/NotFoundObjectResultTest.cs
index af6387f9fa..59604dc062 100644
--- a/src/Http/Http.Results/test/NotFoundObjectResultTest.cs
+++ b/src/Http/Http.Results/test/NotFoundObjectResultTest.cs
@@ -9,59 +9,58 @@ using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Logging.Abstractions;
using Xunit;
-namespace Microsoft.AspNetCore.Http.Result
+namespace Microsoft.AspNetCore.Http.Result;
+
+public class NotFoundObjectResultTest
{
- public class NotFoundObjectResultTest
+ [Fact]
+ public void NotFoundObjectResult_InitializesStatusCode()
{
- [Fact]
- public void NotFoundObjectResult_InitializesStatusCode()
- {
- // Arrange & act
- var notFound = new NotFoundObjectResult(null);
+ // Arrange & act
+ var notFound = new NotFoundObjectResult(null);
- // Assert
- Assert.Equal(StatusCodes.Status404NotFound, notFound.StatusCode);
- }
+ // Assert
+ Assert.Equal(StatusCodes.Status404NotFound, notFound.StatusCode);
+ }
- [Fact]
- public void NotFoundObjectResult_InitializesStatusCodeAndResponseContent()
- {
- // Arrange & act
- var notFound = new NotFoundObjectResult("Test Content");
+ [Fact]
+ public void NotFoundObjectResult_InitializesStatusCodeAndResponseContent()
+ {
+ // Arrange & act
+ var notFound = new NotFoundObjectResult("Test Content");
- // Assert
- Assert.Equal(StatusCodes.Status404NotFound, notFound.StatusCode);
- Assert.Equal("Test Content", notFound.Value);
- }
+ // Assert
+ Assert.Equal(StatusCodes.Status404NotFound, notFound.StatusCode);
+ Assert.Equal("Test Content", notFound.Value);
+ }
- [Fact]
- public async Task NotFoundObjectResult_ExecuteSuccessful()
- {
- // Arrange
- var httpContext = GetHttpContext();
- var result = new NotFoundObjectResult("Test Content");
+ [Fact]
+ public async Task NotFoundObjectResult_ExecuteSuccessful()
+ {
+ // Arrange
+ var httpContext = GetHttpContext();
+ var result = new NotFoundObjectResult("Test Content");
- // Act
- await result.ExecuteAsync(httpContext);
+ // Act
+ await result.ExecuteAsync(httpContext);
- // Assert
- Assert.Equal(StatusCodes.Status404NotFound, httpContext.Response.StatusCode);
- }
+ // Assert
+ Assert.Equal(StatusCodes.Status404NotFound, httpContext.Response.StatusCode);
+ }
- private static HttpContext GetHttpContext()
- {
- var httpContext = new DefaultHttpContext();
- httpContext.Request.PathBase = new PathString("");
- httpContext.Response.Body = new MemoryStream();
- httpContext.RequestServices = CreateServices();
- return httpContext;
- }
+ private static HttpContext GetHttpContext()
+ {
+ var httpContext = new DefaultHttpContext();
+ httpContext.Request.PathBase = new PathString("");
+ httpContext.Response.Body = new MemoryStream();
+ httpContext.RequestServices = CreateServices();
+ return httpContext;
+ }
- private static IServiceProvider CreateServices()
- {
- var services = new ServiceCollection();
- services.AddSingleton<ILoggerFactory, NullLoggerFactory>();
- return services.BuildServiceProvider();
- }
+ private static IServiceProvider CreateServices()
+ {
+ var services = new ServiceCollection();
+ services.AddSingleton<ILoggerFactory, NullLoggerFactory>();
+ return services.BuildServiceProvider();
}
}