Exemple #1
0
        public void ProcessQueue_With_No_Processors_Increases_QueueSize()
        {
            var underTest = new ThrottlingScheduler <int>();

            underTest.AddRequest(Null.Action <int>());
            underTest.ProcessQueue();
            underTest.QueueSize.Should().Be(1);
        }
Exemple #2
0
        public void QueueSize_Increases_With_AddRequest()
        {
            var underTest = new ThrottlingScheduler <int>();

            5.TimesExecute(i =>
            {
                underTest.QueueSize.Should().Be(i);
                underTest.AddRequest(Null.Action <int>());
                underTest.QueueSize.Should().Be(1 + i);
            });
        }
Exemple #3
0
        ProcessQueue_With_Single_Processor_And_Single_Request_Executes_Requests_And_Decreases_QueueSize
            ()
        {
            var underTest = new ThrottlingScheduler <int>();
            var processor = AddProcessor(underTest);
            var request   = Null.Action <int>();

            underTest.AddRequest(request);
            processor.CanCurrentlyExecuteRequest.Returns(true);
            underTest.ProcessQueue();
            processor.Received().Execute(request);
            underTest.QueueSize.Should().Be(0);
        }