Marek M.
Marek M.

Reputation: 3951

Missing Mass Transit AddMassTransitTestHarness method

MT docs (here: https://masstransit-project.com/usage/testing.html) say that for testing a consumer using a container based configuration, we should do something like this:

await using var provider = new ServiceCollection()
    .AddMassTransitTestHarness(cfg =>
    {
        cfg.AddConsumer<SubmitOrderConsumer>();
    })
    .BuildServiceProvider(true);

I have MassTransit 7.3.1 installed, but the sample code method AddMassTransitTestHarness is nowhere to be found. What am I missing here?

Upvotes: 1

Views: 531

Answers (1)

Jaroslaw Matlak
Jaroslaw Matlak

Reputation: 574

Method AddMassTransitTestHarness is implemented in MassTransit as the extension method for IServiceCollection interface in DependencyInjectionTestingExtensions class, which was introduced in version 8.0.0

What you are missing is 8 months of the package updates. Try upgrading MassTransit to the newest version.

Upvotes: 1

Related Questions