public void CollectDataFromTwoQueuesShouldBeSuccess() { //arrange string word1 = "test"; int position1 = 25; string word2 = "test"; int position2 = 56; string word3 = "word"; int position3 = 45; expected.Add(word1, new List <int> { 25, 56 }); expected.Add(word3, new List <int> { 45 }); intermediateQueue.Put(word1, position1); intermediateQueue.Put(word2, position2); intermediateQueue.Put(word3, position3); int countChunks = 2; var collector = new Collector(intermediateQueue, countChunks); intermediateQueue.DetachTask(); intermediateQueue.DetachTask(); //act Dictionary <string, List <int> > actual = collector.GetWordsAndPositionsList(); //assert Assert.AreEqual(expected, actual); }
public void TaskIsDetachedShouldBeCorrectCounter() { //arrange int expected = 2; //act Thread th1 = new Thread(() => intermediateQueue.DetachTask()); Thread th2 = new Thread(() => intermediateQueue.DetachTask()); th1.Start(); th2.Start(); th1.Join(); th2.Join(); int actual = intermediateQueue.CountDetachedTasks(); //assert Assert.AreEqual(expected, actual); }