1 instantiation of BadRequest
Microsoft.AspNetCore.Http.Results (1)
TypedResults.cs (1)
683public static BadRequest<TValue> BadRequest<TValue>(TValue? error) => new(error);
18 references to BadRequest
Microsoft.AspNetCore.Http.Results (2)
TypedResults.cs (2)
682/// <returns>The created <see cref="HttpResults.BadRequest{TValue}"/> for the response.</returns> 683public static BadRequest<TValue> BadRequest<TValue>(TValue? error) => new(error);
Microsoft.AspNetCore.Http.Results.Tests (16)
BadRequestOfTResultTests.cs (10)
25var badRequestObjectResult = new BadRequest<object>(obj); 37var result = new BadRequest<HttpValidationProblemDetails>(obj); 49var result = new BadRequest<string>("Hello"); 66var result = new BadRequest<string>("Hello"); 89var result = new BadRequest<ProblemDetails>(details); 109BadRequest<Todo> MyApi() { throw new NotImplementedException(); } 114PopulateMetadata<BadRequest<Todo>>(((Delegate)MyApi).GetMethodInfo(), builder); 127var result = new BadRequest<object>(null); 138Assert.Throws<ArgumentNullException>("method", () => PopulateMetadata<BadRequest<object>>(null, new RouteEndpointBuilder(requestDelegate: null, RoutePatternFactory.Parse("/"), order: 0))); 139Assert.Throws<ArgumentNullException>("builder", () => PopulateMetadata<BadRequest<object>>(((Delegate)PopulateMetadata_ThrowsArgumentNullException_WhenMethodOrBuilderAreNull).GetMethodInfo(), null));
ResultsTests.cs (5)
229var result = Results.BadRequest(value) as BadRequest<object>; 243var result = Results.BadRequest(value) as BadRequest<Todo>; 1737(() => Results.BadRequest(new()), typeof(BadRequest<object>)),
TypedResultsTests.cs (1)
221var result = TypedResults.BadRequest(value);