public void TestBottleshelf() { Assert.AreEqual(_bs.Size(), shelfsize, "Bottleshelf size"); Assert.AreEqual(_bs.AvailableSlots(), shelfsize, "Bottleshelf available shelfsize"); for (int i = 0; i < shelfsize; i++) { _bs.AddBottle(new Bottle("Testbottle" + i)); Assert.AreEqual(_bs.AvailableSlots(), shelfsize - 1 - i); } Assert.IsFalse(_bs.AddBottle(new Bottle("fail")), "Bottleshelf overflow"); Assert.IsTrue(_bs.RemoveBottle(_bs.Find("Testbottle5")[0])); Assert.AreEqual(_bs.AvailableSlots(), 1); Assert.IsTrue(_bs.RemoveBottle(_bs.Find("Testbottle0")[0])); Assert.IsTrue(_bs.RemoveBottle(_bs.Find("Testbottle9")[0])); Assert.AreEqual(_bs.AvailableSlots(), 3); Assert.AreEqual(0, _bs.Find("Testbottle").Count); var checkBottle = _bs.Find("Testbottle3")[0]; Assert.AreEqual(100, checkBottle.MaxVolume); Assert.AreEqual(checkBottle.Name, "Testbottle3"); var shelf = _bs.Shelf; Assert.AreEqual(shelf.Length, shelfsize, "Shelf length"); Assert.AreEqual(shelf[0], null, "Shelf0"); Assert.AreEqual(shelf[1].Name, "Testbottle1", "Shelf1"); Assert.AreEqual(shelf[2].Name, "Testbottle2", "Shelf2"); Assert.AreEqual(shelf[3].Name, "Testbottle3", "Shelf3"); Assert.AreEqual(shelf[4].Name, "Testbottle4", "Shelf4"); Assert.AreEqual(shelf[5], null, "Shelf5"); Assert.AreEqual(shelf[6].Name, "Testbottle6", "Shelf6"); Assert.AreEqual(shelf[7].Name, "Testbottle7", "Shelf7"); Assert.AreEqual(shelf[8].Name, "Testbottle8", "Shelf8"); Assert.AreEqual(shelf[9], null, "Shelf9"); }
public void InitClasses() { ser = new ServiceLayer.ServiceLayer(); rob = new RobotCellLayer.RobotCellLayer(); da = new DataAccess.DataAccess(); rob.AddRobot("SIM", "SIM"); logic = new LogicLayer.LogicLayer(ser, rob, da); var shelf = new Bottleshelf(10, 0); shelf.AddBottle(new Bottle("Vodka")); shelf.AddBottle(new Bottle("Vesi")); shelf.AddBottle(new Bottle("Mehu")); var queue = new OrderQueue(); var kv = new Drink("Kossuvissy"); Assert.IsTrue(kv.AddPortion("Vodka", 4)); Assert.IsTrue(kv.AddPortion("Vesi", 10)); var mehu = new Drink("Mehu"); Assert.IsTrue(mehu.AddPortion("Mehu", 10)); queue.Add(new Tuple <Order, int>(new Order(OrderType.Drink, 1, 1, kv), 10)); queue.Add(new Tuple <Order, int>(new Order(OrderType.Drink, 2, 4, mehu), 10)); queue.Add(new Tuple <Order, int>(new Order(OrderType.Drink, 3, 3, kv), 10)); queue.Add(new Tuple <Order, int>(new Order(OrderType.Drink, 4, 1, kv), 10)); var startarg = new StartArguments(); startarg.BackupShelf = shelf; startarg.Mode = RunMode.Simulation; startarg.Beer = false; startarg.Drinks = true; startarg.Sparkling = false; startarg.IdleActivity = new Activity(ActivityType.ProcessOrders); startarg.BacckupQueue = queue; var init = Task.Run(() => logic.Initialize(startarg, new CancellationToken())); init.Wait(); Assert.IsTrue(init.Result); }