// Ignoring because the storage client library considers inexistant account as transient so it retries and the exponential back-off could take time
        public void when_cannot_connect_to_storage_account_then_on_completed_should_not_stall_or_throw()
        {
            const string ValidNotExisting = "DefaultEndpointsProtocol=https;AccountName=InexistantDoesntReallyMatter;AccountKey=aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa==";

            using (var sink = new WindowsAzureTableSink("instanceName", ValidNotExisting, "Table", TimeSpan.FromSeconds(1), 5000, TimeSpan.FromSeconds(20)))
                using (var collectErrorsListener = new MockEventListener())
                {
                    collectErrorsListener.EnableEvents(SemanticLoggingEventSource.Log, EventLevel.Error, Keywords.All);

                    sink.OnNext(new CloudEventEntry(EventEntryTestHelper.Create()));
                    Assert.IsTrue(Task.Run(() => sink.OnCompleted()).Wait(TimeSpan.FromSeconds(15)));

                    Assert.IsTrue(collectErrorsListener.WrittenEntries.Any(x => x.EventId == 500));
                }
        }
        // Ignoring because the storage client library considers inexistant account as transient so it retries and the exponential back-off could take time
        public void when_cannot_connect_to_storage_account_then_flush_should_finish_faulted()
        {
            const string ValidNotExisting = "DefaultEndpointsProtocol=https;AccountName=InexistantDoesntReallyMatter;AccountKey=aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa==";

            using (var sink = new WindowsAzureTableSink("instanceName", ValidNotExisting, "Table", TimeSpan.FromSeconds(1), 5000, TimeSpan.FromSeconds(20)))
            using (var collectErrorsListener = new MockEventListener())
            {
                collectErrorsListener.EnableEvents(SemanticLoggingEventSource.Log, EventLevel.Error, Keywords.All);

                sink.OnNext(new CloudEventEntry(EventEntryTestHelper.Create()));
                try
                {
                    Assert.IsTrue(sink.FlushAsync().Wait(TimeSpan.FromSeconds(15)));
                    Assert.Fail("Exception should be thrown.");
                }
                catch (AggregateException ex)
                {
                    Assert.IsInstanceOfType(ex.InnerException, typeof(FlushFailedException));
                }

                Assert.IsTrue(collectErrorsListener.WrittenEntries.Any(x => x.EventId == 500));
            }
        }
        // Ignoring because the storage client library considers inexistant account as transient so it retries and the exponential back-off could take time
        public void when_cannot_connect_to_storage_account_then_flush_should_finish_faulted()
        {
            const string ValidNotExisting = "DefaultEndpointsProtocol=https;AccountName=InexistantDoesntReallyMatter;AccountKey=aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa==";

            using (var sink = new WindowsAzureTableSink("instanceName", ValidNotExisting, "Table", TimeSpan.FromSeconds(1), 5000, TimeSpan.FromSeconds(20)))
                using (var collectErrorsListener = new MockEventListener())
                {
                    collectErrorsListener.EnableEvents(SemanticLoggingEventSource.Log, EventLevel.Error, Keywords.All);

                    sink.OnNext(new CloudEventEntry(EventEntryTestHelper.Create()));
                    try
                    {
                        Assert.IsTrue(sink.FlushAsync().Wait(TimeSpan.FromSeconds(15)));
                        Assert.Fail("Exception should be thrown.");
                    }
                    catch (AggregateException ex)
                    {
                        Assert.IsInstanceOfType(ex.InnerException, typeof(FlushFailedException));
                    }

                    Assert.IsTrue(collectErrorsListener.WrittenEntries.Any(x => x.EventId == 500));
                }
        }
        // Ignoring because the storage client library considers inexistant account as transient so it retries and the exponential back-off could take time
        public void when_cannot_connect_to_storage_account_then_on_completed_should_not_stall_or_throw()
        {
            const string ValidNotExisting = "DefaultEndpointsProtocol=https;AccountName=InexistantDoesntReallyMatter;AccountKey=aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa==";

            using (var sink = new WindowsAzureTableSink("instanceName", ValidNotExisting, "Table", TimeSpan.FromSeconds(1), 5000, TimeSpan.FromSeconds(20)))
            using (var collectErrorsListener = new MockEventListener())
            {
                collectErrorsListener.EnableEvents(SemanticLoggingEventSource.Log, EventLevel.Error, Keywords.All);

                sink.OnNext(new CloudEventEntry(EventEntryTestHelper.Create()));
                Assert.IsTrue(Task.Run(() => sink.OnCompleted()).Wait(TimeSpan.FromSeconds(15)));

                Assert.IsTrue(collectErrorsListener.WrittenEntries.Any(x => x.EventId == 500));
            }
        }