コード例 #1
0
        public void TestGoodCookingByTimer()
        {
            Roaster roaster = new Roaster(2, 2);

            Assert.IsTrue(roaster.Receive(new Bread(), 0, 0));
            Assert.IsTrue(roaster.Receive(new Bread(), 0, 1));
            roaster.Settimer(0, 5);
            roaster.CloseLever(0);
            System.Threading.Thread.Sleep(MSPERTICK * 11);
            // simulate timeout --> lever auto open
            ItemAbstract item = roaster.Release(0, 0);

            Assert.AreEqual(CookingStatus.Cooked, item.CookingStatus);

            item = roaster.Release(0, 1);
            Assert.AreEqual(CookingStatus.Cooked, item.CookingStatus);
        }
コード例 #2
0
        public void TestUnderCookingByForceEnded()
        {
            Roaster roaster = new Roaster(2, 2);

            Assert.IsTrue(roaster.Receive(new Bread(), 1, 0));
            Assert.IsTrue(roaster.Receive(new Bagel(), 1, 1));
            roaster.Settimer(1, 10); // 10 ticks
            roaster.CloseLever(1);

            System.Threading.Thread.Sleep(MSPERTICK * 8);
            roaster.OpenLever(1); // simulate force close

            ItemAbstract item = roaster.Release(1, 0);

            Assert.AreEqual(CookingStatus.Over, item.CookingStatus);

            item = roaster.Release(1, 1);
            Assert.AreEqual(CookingStatus.Under, item.CookingStatus);
        }