You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/index.md
+10-16Lines changed: 10 additions & 16 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -25,22 +25,17 @@ To use the CE, you must build your CE object first by passing the generic `Progr
25
25
Suppose in your main app (`Program` or `Startup`) you call `Services.AddApiClient`(or its variants) twice, registering 2 API clients to make calls to other services, say to the outbound routes `/externalApi` and `/anotherApi` (let's skip the base address for now).
26
26
suppose `ExternalApiClient` invokes an http `GET` method and the other client makes a `POST` http call, inside your API client code.
27
27
28
-
```mermaid
28
+
<br>
29
+
<divclass="mermaid text-center">
29
30
sequenceDiagram
30
-
participant TestClient as Test
31
-
participant MainApp as App
32
-
participant DependencyApp1 as ApiDep1
33
-
participant DependencyApp2 as ApiDep2
34
-
35
-
TestClient->>MainApp: GET /Hello
36
-
MainApp->>DependencyApp1: GET /externalApi
37
-
DependencyApp1-->>MainApp: Response
38
-
MainApp->>DependencyApp2: POST /anotherApi
39
-
DependencyApp2-->>MainApp: Response
40
-
MainApp-->>TestClient: Response
41
-
42
-
```
43
-
31
+
Test->>App: GET /Hello
32
+
App->>ApiDep1: GET /externalApi
33
+
ApiDep1-->>App: Response
34
+
App->>ApiDep2: POST /anotherApi
35
+
ApiDep2-->>App: Response
36
+
App-->>Test: Response
37
+
</div>
38
+
<br>
44
39
### HTTP Mocks 🤡
45
40
46
41
It's easy to **mock** those http clients dependencies (with data stubs) during integration tests making use of `ApiStub.FSharp` lib, saving quite some code compared to manually implementing the `WebApplicationFactory<T>` pattern, let's see how below.
@@ -297,4 +292,3 @@ module Tests =
297
292
* more info on [F# xunit testing](https://learn.microsoft.com/en-us/dotnet/core/testing/unit-testing-fsharp-with-dotnet-test).
298
293
* more general info on aspnetcore integration testing if you use [Nunit](https://learn.microsoft.com/en-us/dotnet/core/testing/unit-testing-fsharp-with-nunit) instead.
299
294
*[aspnetcore integration testing](https://learn.microsoft.com/en-us/aspnet/core/test/integration-tests?view=aspnetcore-7.0) docs in C#
0 commit comments