1 instantiation of Ok
Microsoft.AspNetCore.Http.Results (1)
TypedResults.cs (1)
717public static Ok<TValue> Ok<TValue>(TValue? value) => new(value);
29 references to Ok
Microsoft.AspNetCore.Http.Results (2)
TypedResults.cs (2)
716/// <returns>The created <see cref="HttpResults.Ok{TValue}"/> for the response.</returns> 717public static Ok<TValue> Ok<TValue>(TValue? value) => new(value);
Microsoft.AspNetCore.Http.Results.Tests (15)
OkOfTResultTests.cs (9)
23var result = new Ok<string>(value); 35var result = new Ok<HttpValidationProblemDetails>(obj); 47var result = new Ok<string>("Hello"); 69var result = new Ok<string>("Hello"); 86Ok<Todo> MyApi() { throw new NotImplementedException(); } 91PopulateMetadata<Ok<Todo>>(((Delegate)MyApi).GetMethodInfo(), builder); 104var result = new Ok<object>(null); 115Assert.Throws<ArgumentNullException>("method", () => PopulateMetadata<Ok<object>>(null, new RouteEndpointBuilder(requestDelegate: null, RoutePatternFactory.Parse("/"), order: 0))); 116Assert.Throws<ArgumentNullException>("builder", () => PopulateMetadata<Ok<object>>(((Delegate)PopulateMetadata_ThrowsArgumentNullException_WhenMethodOrBuilderAreNull).GetMethodInfo(), null));
ResultsTests.cs (5)
1210var result = Results.Ok(value) as Ok<object>; 1224var result = Results.Ok(value) as Ok<Todo>; 1764(() => Results.Ok(new()), typeof(Ok<object>)),
TypedResultsTests.cs (1)
1040var result = TypedResults.Ok(value);
Microsoft.AspNetCore.Identity (5)
IdentityApiEndpointRouteBuilderExtensions.cs (5)
90routeGroup.MapPost("/login", async Task<Results<Ok<AccessTokenResponse>, EmptyHttpResult, ProblemHttpResult>> 122routeGroup.MapPost("/refresh", async Task<Results<Ok<AccessTokenResponse>, UnauthorizedHttpResult, SignInHttpResult, ChallengeHttpResult>> 260accountGroup.MapPost("/2fa", async Task<Results<Ok<TwoFactorResponse>, ValidationProblem, NotFound>> 336accountGroup.MapGet("/info", async Task<Results<Ok<InfoResponse>, ValidationProblem, NotFound>> 348accountGroup.MapPost("/info", async Task<Results<Ok<InfoResponse>, ValidationProblem, NotFound>>
Microsoft.AspNetCore.Mvc.ApiExplorer.Test (2)
DefaultApiDescriptionProviderTest.cs (2)
2427private Http.HttpResults.Ok<Product> ReturnsResultOfProductWithEndpointMetadata() => null; 2432private Task<Http.HttpResults.Ok<Product>> ReturnsTaskOfResultOfProductWithEndpointMetadata() => null;
Microsoft.AspNetCore.OpenApi.Tests (3)
Extensions\JsonTypeInfoExtensionsTests.cs (3)
48[typeof(Results<Ok<TodoWithDueDate>, Ok<Todo>>), "ResultsOfOkOfTodoWithDueDateAndOkOfTodo"], 49[typeof(Ok<Todo>), "OkOfTodo"],
MinimalSample (1)
Program.cs (1)
72app.MapGet("/todo/{id}", Results<Ok<Todo>, NotFound, BadRequest> (int id) => id switch
Sample (1)
Program.cs (1)
100schemas.MapGet("/multiple-results", Results<Ok<Triangle>, NotFound<string>> () => Random.Shared.Next(0, 2) == 0