public void Ok_WithNoArgs_ResultHasCorrectValues()
    {
        // Act
        var result = TypedResults.Ok();

        // Assert
        Assert.Equal(StatusCodes.Status200OK, result.StatusCode);
    }
    public void Ok_WithValue_ResultHasCorrectValues()
    {
        // Arrange
        var value = new { };

        // Act
        var result = TypedResults.Ok(value);

        // Assert
        Assert.Equal(StatusCodes.Status200OK, result.StatusCode);
        Assert.Equal(value, result.Value);
    }
Beispiel #3
0
 /// <summary>
 /// Produces a <see cref="StatusCodes.Status200OK"/> 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 Ok(object?value = null)
 => value is null?TypedResults.Ok() : TypedResults.Ok(value);
Beispiel #4
0
 /// <summary>
 /// Produces a <see cref="StatusCodes.Status200OK"/> 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 Ok <TValue>(TValue?value)
 => value is null?TypedResults.Ok() : TypedResults.Ok(value);