forked from Manuel/meeting-assistant
ci: consolidate platform pipelines and test prerequisites on macOS support
This commit is contained in:
1 parent
1b19b08f2e
commit
728e66dd72
76 files changed
+7477
-239
No files matched your search
@@ -0,0 +1,25 @@
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using Microsoft.AspNetCore.Mvc.Testing;
|
||||
using Microsoft.AspNetCore.TestHost;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
|
||||
namespace MeetingAssistant.Tests;
|
||||
|
||||
public sealed class IsolatedApplicationFactory : WebApplicationFactory<Program>
|
||||
{
|
||||
protected override void ConfigureWebHost(IWebHostBuilder builder)
|
||||
{
|
||||
builder.ConfigureTestServices(services =>
|
||||
{
|
||||
// Endpoint tests retain production composition but opt into each background activity they exercise.
|
||||
foreach (var descriptor in services.Where(descriptor =>
|
||||
descriptor.ServiceType == typeof(IHostedService) &&
|
||||
(descriptor.ImplementationType?.Assembly == typeof(Program).Assembly ||
|
||||
descriptor.ImplementationFactory is not null)).ToArray())
|
||||
{
|
||||
services.Remove(descriptor);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user