public void ServiceTest_Queue_SimilarFiles() { FileQueue fileQueue = new FileQueue(); for (int i = 0; i < 5; i++) fileQueue.Push(new FileQueueElement("file0", "cmd" + i.ToString(), "utf-8")); Assert.AreEqual(1, fileQueue.Count); }
public void ServiceTest_QueueAccess() { FileQueue fileQueue = new FileQueue(); for (int i = 0; i < 10; i++) { Thread th = new Thread(x => { for (int n = 0; n < 10; n++) { fileQueue.Push(new FileQueueElement("file"+x.ToString()+n.ToString(), "cmd"+n.ToString(), "utf-8")); Debug.WriteLine("Add item (file{0}{1},cmd{1})", (int)x, n); } }); th.Start(i); } Thread.Sleep(5000); Assert.AreEqual(100, fileQueue.Count); }