public void MiddlewareShouldCollectAndWriteMultiple()
        {
            var maxMessages = 0;

            using var middleware = new ConcurrentCollectMiddleware
                  {
                      NextMiddleware = new ActionMiddleware(messages =>
                {
                    Thread.Sleep(10);

                    var count = messages.Count();
                    if (maxMessages < count)
                    {
                        maxMessages = count;
                    }
                })
                  };

            for (var i = 0; i < 25; i++)
            {
                middleware.Execute(new LogMessage());
            }

            middleware.Flush();

            Assert.NotEqual(0, maxMessages);
            Assert.NotEqual(1, maxMessages);
        }
        public void FlushShouldWriteAllMessages()
        {
            var messagesCount = 0;

            using var middleware = new ConcurrentCollectMiddleware
                  {
                      NextMiddleware = new ActionMiddleware(messages =>
                {
                    Thread.Sleep(10);

                    var count      = messages.Count();
                    messagesCount += count;
                })
                  };

            for (var i = 0; i < 25; i++)
            {
                middleware.Execute(new LogMessage());
            }

            middleware.Flush();

            Assert.Equal(25, messagesCount);
        }