public async Task SendEnumerableEnsuresNotClosed()
        {
            var producer = new AmqpProducer("aHub", null, Mock.Of <AmqpConnectionScope>(), new AmqpMessageConverter(), Mock.Of <EventHubsRetryPolicy>());
            await producer.CloseAsync(CancellationToken.None);

            Assert.That(async() => await producer.SendAsync(Enumerable.Empty <EventData>(), new SendOptions(), CancellationToken.None), Throws.InstanceOf <EventHubsClientClosedException>());
        }
        public void SendEnumerableRespectsTheCancellationTokenIfSetWhenCalled()
        {
            using CancellationTokenSource cancellationSource = new CancellationTokenSource();
            cancellationSource.Cancel();

            var producer = new AmqpProducer("aHub", null, Mock.Of <AmqpConnectionScope>(), new AmqpMessageConverter(), Mock.Of <EventHubsRetryPolicy>());

            Assert.That(async() => await producer.SendAsync(new[] { new EventData(new byte[] { 0x15 }) }, new SendOptions(), cancellationSource.Token), Throws.InstanceOf <TaskCanceledException>());
        }
        public void SendBatchValidatesTheBatch()
        {
            var producer = new AmqpProducer("aHub", null, Mock.Of <AmqpConnectionScope>(), new AmqpMessageConverter(), Mock.Of <EventHubsRetryPolicy>());

            Assert.That(async() => await producer.SendAsync(null, CancellationToken.None), Throws.ArgumentNullException);
        }