public void should_invoke_directly_if_queue_is_empty()
        {
            var uploadIsInvoked = false;
            var directly        = false;
            var sut             = new UploadQueue <string>(x => uploadIsInvoked = true);

            sut.ActivateSync = true;

            sut.AddIfNotEmpty("hello", () => directly = true);

            sut.Wait(100);
            directly.Should().BeTrue("because queue is empty");
            uploadIsInvoked.Should()
            .BeFalse(
                "because it should not be invoked if a task is supplied as an argument and the queue was empty.");
        }
        public void should_not_invoke_directly_if_queue_got_items()
        {
            var uploadIsInvoked = false;
            var directly        = false;
            var sut             = new UploadQueue <string>(x =>
            {
                uploadIsInvoked = true;
                Thread.Sleep(50);
            });

            sut.Add("precondition");
            sut.ActivateSync = true;

            sut.AddIfNotEmpty("hello", () => directly = true);

            sut.Wait(10000);
            directly.Should().BeFalse("because there is an active worker");
            uploadIsInvoked.Should()
            .BeTrue(
                "because it should be invoked even if a task is supplied as an argument when the queue is not empty");
        }