示例#1
0
        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);
            });
        }
示例#3
0
 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)
 {
 }