public void WithServiceBusFallbackMessageHandlerImplementationFunction_WithoutImplementationFunction_Throws()
        {
            // Arrange
            var services = new ServiceBusMessageHandlerCollection(new ServiceCollection());

            // Act / Assert
            Assert.ThrowsAny <ArgumentException>(
                () => services.WithServiceBusFallbackMessageHandler(createImplementation: (Func <IServiceProvider, PassThruServiceBusFallbackMessageHandler>)null));
        }
        public void WithServiceBusFallbackMessageHandler_WithValidType_RegistersInterface()
        {
            // Arrange
            var collection = new ServiceBusMessageHandlerCollection(new ServiceCollection());

            // Act
            collection.WithServiceBusFallbackMessageHandler <PassThruServiceBusFallbackMessageHandler>();

            // Assert
            IServiceProvider provider = collection.Services.BuildServiceProvider();
            var messageHandler        = provider.GetRequiredService <IAzureServiceBusFallbackMessageHandler>();

            Assert.IsType <PassThruServiceBusFallbackMessageHandler>(messageHandler);
        }
        public void WithServiceBusFallbackMessageHandler_WithValidImplementationFunction_RegistersInterface()
        {
            // Arrange
            var collection = new ServiceBusMessageHandlerCollection(new ServiceCollection());
            var expected   = new PassThruServiceBusFallbackMessageHandler();

            // Act
            collection.WithServiceBusFallbackMessageHandler(serviceProvider => expected);

            // Assert
            IServiceProvider provider = collection.Services.BuildServiceProvider();
            var actual = provider.GetRequiredService <IAzureServiceBusFallbackMessageHandler>();

            Assert.Same(expected, actual);
        }