public void LogicTest() { var ct = new CancellationTokenSource(); var runtask = Task.Run(() => logic.Run(ct.Token)); while (logic.Queue.Count > 0) { Task.Delay(100).Wait(); } ct.Cancel(); runtask.Wait(); Assert.AreEqual(0, logic.Queue.Count); //Assert.AreEqual(80, logic.CurrentShelf.Find("Mehu").Volume); Assert.AreEqual(80, logic.CurrentShelf.Find("Vodka") [0].Volume); //Assert.IsNull(logic.CurrentShelf.Find("Mehu")); Assert.AreEqual(50, logic.CurrentShelf.Find("Vesi")[0].Volume); logic.Dispose(); }