public async Task CreatedAtRouteResult_ReturnsStatusCode_SetsLocationHeader(object values)
        {
            // Arrange
            var expectedUrl = "testAction";
            var httpContext = GetHttpContext(expectedUrl);

            // Act
            var result = new CreatedAtRouteResult(routeName: null, routeValues: values, value: null);
            await result.ExecuteAsync(httpContext);

            // Assert
            Assert.Equal(StatusCodes.Status201Created, httpContext.Response.StatusCode);
            Assert.Equal(expectedUrl, httpContext.Response.Headers["Location"]);
        }
        public async Task CreatedAtRouteResult_ThrowsOnNullUrl()
        {
            // Arrange
            var httpContext = GetHttpContext(expectedUrl: null);

            var result = new CreatedAtRouteResult(
                routeName: null,
                routeValues: new Dictionary <string, object>(),
                value: null);

            // Act & Assert
            await ExceptionAssert.ThrowsAsync <InvalidOperationException>(
                async() => await result.ExecuteAsync(httpContext),
                "No route matches the supplied values.");
        }