diff options
author | Pranav K <prkrishn@hotmail.com> | 2021-11-06 03:52:08 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-11-06 03:52:08 +0300 |
commit | a450cb69b5e4549f5515cdb057a68771f56cefd7 (patch) | |
tree | b31cc4cd3257b8aeec14a5481121dac6964195a6 /src/Http/Http.Results/test/NotFoundObjectResultTest.cs | |
parent | b9fcd82fe9d0883e9828864a8e8b2231f469254f (diff) |
Use file scoped namespaces (#38076)
* Use file scoped namespaces
Diffstat (limited to 'src/Http/Http.Results/test/NotFoundObjectResultTest.cs')
-rw-r--r-- | src/Http/Http.Results/test/NotFoundObjectResultTest.cs | 87 |
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(); } } |