public async Task Should_Be_Able_To_Resolve_Middleware_With_Parameter() { /* Setup */ using var container = new SimpleDependencyInjectionContainer(); container.AddZyRabbit(); // Configure middleware via options to throw the InvalidOperationException exception var options = new ExchangeDeclareOptions { ThrowOnFailFunc = _ => true }; /* Test */ var middleware = container.GetService <ExchangeDeclareMiddleware>(options); /* Assert */ await Assert.ThrowsAnyAsync <InvalidOperationException>(async() => { await middleware.InvokeAsync(null, CancellationToken.None); }); }
public async Task Should_Be_Able_To_Resolve_Middleware_With_Parameter() { /* Setup */ var serviceCollection = new ServiceCollection(); serviceCollection.AddZyRabbit(); using var provider = serviceCollection.BuildServiceProvider(); var providerAdapter = new ServiceProviderAdapter(provider); // Configure middleware via options to throw the InvalidOperationException exception var options = new ExchangeDeclareOptions { ThrowOnFailFunc = _ => true }; /* Test */ var middleware = providerAdapter.GetService <ExchangeDeclareMiddleware>(options); /* Assert */ await Assert.ThrowsAnyAsync <InvalidOperationException>(async() => { await middleware.InvokeAsync(null, CancellationToken.None); }); }
public ExchangeDeclareMiddleware(ITopologyProvider topologyProvider, ILogger <Pipe.Middleware.ExchangeDeclareMiddleware> logger, ExchangeDeclareOptions options = null) : base(topologyProvider, logger, options) { }
public ExchangeDeclareMiddleware(ITopologyProvider topologyProvider, ExchangeDeclareOptions options = null) : base(topologyProvider, options) { }