Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 0 additions & 25 deletions src/Swisschain.Extensions.Testing/ServiceCollectionExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,30 +24,5 @@ public static void RemoveDbSchemaValidationHost(this IServiceCollection services
services.Remove(descriptor);
}
}

public static void ReconfigureMassTransitInMemory(this IServiceCollection services)
{
var descriptors = services.Where(d =>
d.ServiceType.Namespace?.Contains("MassTransit", StringComparison.OrdinalIgnoreCase) == true)
.ToList();

foreach (var descriptor in descriptors)
{
services.Remove(descriptor);
}

services.AddMassTransitInMemoryTestHarness();
services.AddMassTransitBusHost();
services.AddSingleton<IBusControl>(c =>
{
var testHarness = c.GetRequiredService<InMemoryTestHarness>();
if (testHarness.BusControl == null)
{
testHarness.Start().GetAwaiter().GetResult();
}

return testHarness.BusControl;
});
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
<PackageReference Include="Ductus.FluentDocker" Version="2.10.7" />
<PackageReference Include="Grpc.Net.Client" Version="2.48.0" />
<PackageReference Include="MassTransit" Version="7.2.4" />
<PackageReference Include="MassTransit.Extensions.DependencyInjection" Version="7.2.4" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="5.0.9" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="5.0.9" />
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,9 +144,6 @@ protected override void ConfigureWebHost(IWebHostBuilder builder)
// remove pending migrations checker
x.RemoveDbSchemaValidationHost();

// remove mass transit registrations and register anew with in-memory impl
x.ReconfigureMassTransitInMemory();

ConfigureServicesEx(x);
});
}
Expand Down