Ejemplo n.º 1
0
        public void NotFoundObjectResult_InitializesStatusCode()
        {
            // Arrange & act
            var notFound = new NotFoundObjectResult(null);

            // Assert
            Assert.Equal(StatusCodes.Status404NotFound, notFound.StatusCode);
        }
Ejemplo n.º 2
0
        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);
        }
Ejemplo n.º 3
0
        public async Task NotFoundObjectResult_ExecuteSuccessful()
        {
            // Arrange
            var httpContext = GetHttpContext();
            var result      = new NotFoundObjectResult("Test Content");

            // Act
            await result.ExecuteAsync(httpContext);

            // Assert
            Assert.Equal(StatusCodes.Status404NotFound, httpContext.Response.StatusCode);
        }