예제 #1
0
        public virtual void TestDrainToWithLimit()
        {
            Configuration conf = new Configuration();

            conf.SetInt("ns." + FairCallQueue.IpcCallqueuePriorityLevelsKey, 2);
            FairCallQueue <Schedulable> fcq2 = new FairCallQueue <Schedulable>(10, "ns", conf);

            fcq.SetScheduler(alwaysZeroScheduler);
            fcq2.SetScheduler(alwaysZeroScheduler);
            // Start with 3 in fcq, to be drained
            for (int i = 0; i < 3; i++)
            {
                fcq.Offer(MockCall("c"));
            }
            fcq.DrainTo(fcq2, 2);
            Assert.Equal(1, fcq.Count);
            Assert.Equal(2, fcq2.Count);
        }
예제 #2
0
 public virtual void TestOfferSucceeds()
 {
     fcq.SetScheduler(alwaysZeroScheduler);
     for (int i = 0; i < 5; i++)
     {
         // We can fit 10 calls
         Assert.True(fcq.Offer(MockCall("c")));
     }
     Assert.Equal(5, fcq.Count);
 }