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
@@ -90,8 +90,8 @@ You can also import full [repository snapshots](https://microcks.io/documentatio
90
90
91
91
```csharp
92
92
MicrocksContainercontainer=newMicrocksBuilder()
93
-
.WithSnapshots("microcks-repository.json")
94
-
.Build();
93
+
.WithSnapshots("microcks-repository.json")
94
+
.Build();
95
95
awaitcontainer.StartAsync();
96
96
```
97
97
@@ -119,8 +119,8 @@ private int port;
119
119
publicasyncTaskInitializeAsync()
120
120
{
121
121
container=newMicrocksBuilder()
122
-
.WithExposedPort(port)
123
-
.Build();
122
+
.WithExposedPort(port)
123
+
.Build();
124
124
awaitcontainer.StartAsync();
125
125
}
126
126
@@ -142,6 +142,67 @@ public async Task testOpenAPIContract()
142
142
143
143
The `TestResult` gives you access to all details regarding success of failure on different test cases.
144
144
145
+
**Important:** You must host the API on a port that is accessible from the Microcks container. If your tests are using WebApplicationFactory, the API is hosted on an in-memory server and does not expose a port.
146
+
147
+
One way to do this is to specify a URL to the WebApplication. However, this requires not to use the minimal hosting model (Program.cs without Main and without Startup.cs).
148
+
149
+
Refactor your `Program.cs` to use Main and create a new class ApplicationBuilder for example, and copy the content of your `Program.cs` into it.
150
+
151
+
See below an example of a minimal hosting model with a `Main` method:
0 commit comments