Beispiel #1
0
        public void Coin_OtherInstanceIsAlarm_ReturnFalse()
        {
            t.Coin();
            Turnstile t1 = new Turnstile();

            Assert.That(t1.Alarm(), Is.False);
        }
        //
        // responds to Pass event
        //
        public override void Pass(Turnstile name)
        {
            name.Alarm();

            // change the state
            name.SetState(name.GetItsLockedState());
        }
Beispiel #3
0
        public void Pass_OtherInstanceIsAlarm_ReturnTrue()
        {
            t.Pass();
            Turnstile t1 = new Turnstile();

            Assert.That(t1.Alarm(), Is.True);
        }
        public void TestInit()
        {
            Turnstile t = new Turnstile();

            Assert.IsTrue(t.Locked());
            Assert.IsFalse(t.Alarm());
        }
Beispiel #5
0
        public void CancelAlarm_OtherInstanceIsLocked_ReturnFalse()
        {
            t.Pass();
            t.Coin();
            Turnstile t1 = new Turnstile();

            Assert.That(t1.Alarm(), Is.False, "locked");
        }
        public void TestPass()
        {
            Turnstile t = new Turnstile();

            t.Pass();

            Turnstile t1 = new Turnstile();

            Assert.IsTrue(t1.Alarm(), "alarm");
            Assert.IsTrue(t1.Locked(), "locked");
        }
        public void TestCoin()
        {
            Turnstile t = new Turnstile();

            t.Coin();
            Turnstile t1 = new Turnstile();

            Assert.IsFalse(t1.Locked());
            Assert.IsFalse(t1.Alarm());
            Assert.AreEqual(1, t1.Coins);
        }
        public void TestCoinAndPass()
        {
            Turnstile t = new Turnstile();

            t.Coin();
            t.Pass();

            Turnstile t1 = new Turnstile();

            Assert.IsTrue(t1.Locked());
            Assert.IsFalse(t1.Alarm());
            Assert.AreEqual(1, t1.Coins, "coins");
        }
        public void TestCancelAlarm()
        {
            Turnstile t = new Turnstile();

            t.Pass();
            t.Coin();

            Turnstile t1 = new Turnstile();

            Assert.IsFalse(t1.Alarm(), "alarm");
            Assert.IsFalse(t1.Locked(), "locked");
            Assert.AreEqual(1, t1.Coins, "coin");
            Assert.AreEqual(0, t1.Refunds, "refund");
        }
        public void TestTwoCoins()
        {
            Turnstile t = new Turnstile();

            t.Coin();
            t.Coin();

            Turnstile t1 = new Turnstile();

            Assert.IsFalse(t1.Locked(), "unlocked");
            Assert.AreEqual(1, t1.Coins, "coins");
            Assert.AreEqual(1, t1.Refunds, "refunds");
            Assert.IsFalse(t1.Alarm());
        }
Beispiel #11
0
 public void Init_IsAlarm_ReturnFalse()
 {
     Assert.That(t.Alarm(), Is.False);
 }
 public void Pass(Turnstile t)
 {
     t.Alarm();
 }