public void Conflict_WithNoArgs_ResultHasCorrectValues()
    {
        // Act
        var result = TypedResults.Conflict();

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

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

        // Assert
        Assert.Equal(StatusCodes.Status409Conflict, result.StatusCode);
        Assert.Equal(value, result.Value);
    }
Beispiel #3
0
 /// <summary>
 /// Produces a <see cref="StatusCodes.Status409Conflict"/> response.
 /// </summary>
 /// <param name="error">An error object to be included in the HTTP response body.</param>
 /// <returns>The created <see cref="IResult"/> for the response.</returns>
 public static IResult Conflict(object?error = null)
 => error is null?TypedResults.Conflict() : TypedResults.Conflict(error);
Beispiel #4
0
 /// <summary>
 /// Produces a <see cref="StatusCodes.Status409Conflict"/> response.
 /// </summary>
 /// <param name="error">An error object to be included in the HTTP response body.</param>
 /// <returns>The created <see cref="IResult"/> for the response.</returns>
 public static IResult Conflict <TValue>(TValue?error)
 => error is null?TypedResults.Conflict() : TypedResults.Conflict(error);