Skip to content

Commit 4ca1382

Browse files
add more context to sample (#36107)
* add more context to sample * Update date for test-min-api.md Just updated the ms.date metadata. --------- Co-authored-by: Wade Pickett <[email protected]>
1 parent cc7a3fc commit 4ca1382

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

aspnetcore/fundamentals/minimal-apis/test-min-api.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ title: Test Minimal API apps
33
author: wadepickett
44
description: Unit and integration tests in Minimal API apps
55
ms.author: wpickett
6-
ms.date: 05/31/2024
6+
ms.date: 09/15/2025
77
monikerRange: '>= aspnetcore-7.0'
88
uid: fundamentals/minimal-apis/test-min-api
99
---
@@ -20,15 +20,17 @@ The [sample code on GitHub](https://github.com/dotnet/AspNetCore.Docs.Samples/tr
2020

2121
<a name="iit7"></a>
2222

23-
## IResult implementation types
23+
## Unit test IResult implementation types
24+
25+
The following example shows how to unit test minimal route handlers that return <xref:Microsoft.AspNetCore.Http.IResult> using the [xUnit](https://github.com/xunit/xunit/) testing framework. The external database is replaced with an in-memory database during testing, the implementation of the `MockDb` can be found in the [sample code](https://github.com/dotnet/AspNetCore.Docs.Samples/blob/main/fundamentals/minimal-apis/samples/MinApiTestsSample/UnitTests/Helpers/MockDb.cs).
2426

2527
Public <xref:Microsoft.AspNetCore.Http.IResult> implementation types in the <xref:Microsoft.AspNetCore.Http.HttpResults?displayProperty=fullName> namespace can be used to unit test minimal route handlers when using named methods instead of lambdas.
2628

27-
The following code uses the [`NotFound<TValue>`](/dotnet/api/microsoft.aspnetcore.http.httpresults.notfound-1) class:
29+
The following code uses the <xref:Microsoft.AspNetCore.Http.HttpResults.NotFound%601> class:
2830

2931
:::code language="csharp" source="~/../AspNetCore.Docs.Samples/fundamentals/minimal-apis/samples/MinApiTestsSample/UnitTests/TodoInMemoryTests.cs" id="snippet_" highlight="8":::
3032

31-
The following code uses the [`Ok<TValue>`](/dotnet/api/microsoft.aspnetcore.http.httpresults.ok-1) class:
33+
The following code uses the <xref:Microsoft.AspNetCore.Http.HttpResults.Ok%601> class:
3234

3335
:::code language="csharp" source="~/../AspNetCore.Docs.Samples/fundamentals/minimal-apis/samples/MinApiTestsSample/UnitTests/TodoInMemoryTests.cs" id="snippet_1" highlight="18":::
3436

0 commit comments

Comments
 (0)