public void CanRunWithoutIndividualAwait()
        {
            var stopWatch = new Stopwatch();
            var queue     = new MemoryQueue <string>(nameof(CanRunWithoutIndividualAwait));

            queue.SetQueueItemAction(SlowItemAction, true);
            queue.KeepQueueAliveTimeSpan = TimeSpan.Zero;
            stopWatch.Start();
            for (var i = 0; i < 20000; i++)
            {
                queue.AddMessage($"item {i}");
            }

            UT.Assert.IsTrue(queue.OnlyForUnitTest_HasAliveBackgroundWorker);
            while (queue.OnlyForUnitTest_HasAliveBackgroundWorker)
            {
                Console.WriteLine($"LatestItemFetchedAfterActiveTimeSpan: {queue.LatestItemFetchedAfterActiveTimeSpan.TotalMilliseconds} milliseconds.");
                Thread.Sleep(TimeSpan.FromMilliseconds(20));
            }
            stopWatch.Stop();
            Console.WriteLine($"LatestItemFetchedAfterActiveTimeSpan: {queue.LatestItemFetchedAfterActiveTimeSpan.TotalMilliseconds} milliseconds.");
            Console.WriteLine();
            Console.WriteLine($"Total time: {stopWatch.Elapsed.TotalMilliseconds} milliseconds");
            UT.Assert.AreEqual(TimeSpan.Zero, queue.LatestItemFetchedAfterActiveTimeSpan);
            UT.Assert.IsTrue(stopWatch.ElapsedMilliseconds < 2000);
        }
        public void MessageCountIncreasedWhenAddingToQueue()
        {
            var queue         = new MemoryQueue <string>("queueName");
            var expectedCount = 5;

            for (var i = 0; i < expectedCount; i++)
            {
                queue.AddMessage($"item {i}");
            }

            var count = queue.GetApproximateMessageCountAsync().Result;

            UT.Assert.AreEqual(expectedCount, count);
        }