Minimal APIs are great, but how do you test them without a `Startup` class?
WebApplicationFactory
You must expose the internal `Program` class to your test project.
// Program.cs
var app = builder.Build();
// ...
app.Run();
// Hack to make it visible
public partial class Program { }
Now you can use `WebApplicationFactory<Program>` in xUnit to spin up the in-memory server.
Discover more from C4: Container, Code, Cloud & Context
Subscribe to get the latest posts sent to your email.