public void When_number_of_LogEvents_greatly_exceeds_Buffer_then_Buffer_is_sent_to_ElasticSearch()
        {
            using (var context = UnitTestContext.Create())
            {
                var loggingEvents = LoggingEventsBuilder.GreaterThan(context.Appender.BufferSize + 1).ToArray();

                context.Appender.DoAppend(loggingEvents);

                Retry.Ignoring <AssertException>(() => context.Repository.LogEntries.TotalCount()
                                                 .Should()
                                                 .Be(context.Appender.BufferSize + 1,
                                                     "buffer should be sent to ElasticSearch"));
            }
        }
        public void When_number_of_LogEvents_greatly_exceeds_Buffer_then_remaining_entries_are_sent_to_ElasticSearch_when_Appender_closes()
        {
            using (var context = UnitTestContext.Create())
            {
                var loggingEvents = LoggingEventsBuilder.GreaterThan(100 + 1).ToArray();

                context.Appender.DoAppend(loggingEvents);
                context.Appender.Close();

                Retry.Ignoring <XunitException>(() => context.Repository.LogEntries.TotalCount()
                                                .Should()
                                                .Be(loggingEvents.Count(),
                                                    "all events should be logged by the time the buffer closes"));
            }
        }