Example #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);
        }
Example #2
0
 CanCurrentlyExecuteRequest_Is_True_After_Completion_Of_Request_If_No_Limit_Hit
     ()
 {
     LetTimeGiverUseRealTime();
     mUnderTest.MaximumRequestCountPerDuration = int.MaxValue;
     mUnderTest.Execute(Null.Action <int>());
     mUnderTest.CanCurrentlyExecuteRequest.Should().BeTrue();
 }
Example #3
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);
            });
        }
Example #4
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);
        }
Example #5
0
 public void Action_With_Argument_Does_Nothing()
 {
     // actually, I don't see any way to prove that the following call does nothing ;)
     Null.Action <int>()(3);
 }
Example #6
0
 public void Action_Does_Nothing()
 {
     // actually, I don't see any way to prove that the following call does nothing ;)
     Null.Action()();
 }