public async Task Delegates_creation_to_messaging_factory()
        {
            var settings = DefaultConfigurationValues.Apply(SettingsHolderFactory.BuildWithSerializer());

            var factory = new InterceptedMessagingFactory();

            var creator = new MessageSenderCreator(new InterceptedMessagingFactoryFactory(factory), settings);

            var sender = await creator.Create("myqueue", null, AzureServiceBusConnectionString.Value);

            Assert.IsTrue(factory.IsInvoked);
            Assert.IsInstanceOf <IMessageSenderInternal>(sender);
        }
        public async Task Delegates_creation_to_messaging_factory()
        {
            var settings = new DefaultConfigurationValues().Apply(new SettingsHolder());

            var factory = new InterceptedMessagingFactory();

            var creator = new MessageReceiverCreator(new InterceptedMessagingFactoryFactory(factory), settings);

            var receiver = await creator.Create("myqueue", AzureServiceBusConnectionString.Value);

            Assert.IsTrue(factory.IsInvoked);
            Assert.IsInstanceOf <IMessageReceiver>(receiver);
        }
        public async Task Applies_user_defined_connectivity_settings()
        {
            var settings = DefaultConfigurationValues.Apply(SettingsHolderFactory.BuildWithSerializer());

            var extensions = new TransportExtensions <AzureServiceBusTransport>(settings);

            extensions.MessageSenders()
            .RetryPolicy(RetryPolicy.NoRetry);

            var factory = new InterceptedMessagingFactory();

            var creator = new MessageSenderCreator(new InterceptedMessagingFactoryFactory(factory), settings);

            var sender = await creator.Create("myqueue", null, AzureServiceBusConnectionString.Value);

            Assert.IsInstanceOf <NoRetry>(sender.RetryPolicy);
        }
        public async Task Applies_user_defined_connectivity_settings()
        {
            var settings = DefaultConfigurationValues.Apply(SettingsHolderFactory.BuildWithSerializer());

            var extensions = new TransportExtensions <AzureServiceBusTransport>(settings);

            extensions.MessageReceivers()
            .PrefetchCount(1000)
            .RetryPolicy(RetryPolicy.NoRetry)
            .ReceiveMode(ReceiveMode.ReceiveAndDelete);

            var factory = new InterceptedMessagingFactory();

            var creator = new MessageReceiverCreator(new InterceptedMessagingFactoryFactory(factory), settings);

            var receiver = await creator.Create("myqueue", AzureServiceBusConnectionString.Value);

            Assert.AreEqual(ReceiveMode.ReceiveAndDelete, receiver.Mode);
            Assert.IsInstanceOf <NoRetry>(receiver.RetryPolicy);
            Assert.AreEqual(1000, receiver.PrefetchCount);
        }