public TestClass() { for (int i = 0; i < 99997; i++) { _queue.Enqueue(new GenericClass()); } _queue.Enqueue(_generic); _queue.Enqueue(new GenericClass()); _queue.Enqueue(new GenericClass()); var e = _queue.History; }
public void LastDequeueTest() { var q = new ManagedQueue <GenericClass>(); Console.WriteLine("---------Queue Created---------"); Thread.Sleep(5000); Console.WriteLine(q.WaitingTime); q.Enqueue(new GenericClass()); Thread.Sleep(5000); q.Enqueue(new GenericClass()); Thread.Sleep(10000); Console.WriteLine(q.WaitingTime); //output should be ~15 seconds q.TryDequeue(out _); Thread.Sleep(5000); Console.WriteLine(q.WaitingTime); //output should be ~5 seconds Thread.Sleep(5000); q.TryDequeue(out _); Thread.Sleep(5000); Console.WriteLine(q.WaitingTime);//output should be ~5 seconds }
public void GrowthRateTest() { var q = new ManagedQueue <GenericClass>(); for (int i = 0; i < 375600; i++) { switch (new Random().Next(1, 3)) { case 1: q.Enqueue(new GenericClass()); break; case 2: q.TryDequeue(out _); break; } Console.WriteLine(q.GrowthRate); //Thread.Sleep(500); } }