public void NotFound_WithNoArgs_ResultHasCorrectValues() { // Act var result = TypedResults.NotFound(); // Assert Assert.Equal(StatusCodes.Status404NotFound, result.StatusCode); }
public void NotFound_WithValue_ResultHasCorrectValues() { // Arrange var value = new { }; // Act var result = TypedResults.NotFound(value); // Assert Assert.Equal(StatusCodes.Status404NotFound, result.StatusCode); Assert.Equal(value, result.Value); }
/// <summary> /// Produces a <see cref="StatusCodes.Status404NotFound"/> response. /// </summary> /// <param name="value">The value to be included in the HTTP response body.</param> /// <returns>The created <see cref="IResult"/> for the response.</returns> public static IResult NotFound(object?value = null) => value is null?TypedResults.NotFound() : TypedResults.NotFound(value);
/// <summary> /// Produces a <see cref="StatusCodes.Status404NotFound"/> response. /// </summary> /// <param name="value">The value to be included in the HTTP response body.</param> /// <returns>The created <see cref="IResult"/> for the response.</returns> public static IResult NotFound <TValue>(TValue?value) => value is null?TypedResults.NotFound() : TypedResults.NotFound(value);