예제 #1
0
        public void DeactivateTest()
        {
            LightSensor ls = new LightSensor();
            FireSensor  fs = new FireSensor();
            DoorSensor  ds = new DoorSensor();

            ls.Activate();
            fs.Activate();
            ds.Activate();

            Assert.IsNotNull(ls.alarm);
            Assert.IsNotNull(fs.alarm);
            Assert.IsNotNull(ds.alarm);

            bool lsStatus = ls.checkStatus();
            bool fsStatus = fs.checkStatus();
            bool dsStatus = ds.checkStatus();

            Assert.IsTrue(lsStatus);
            Assert.IsTrue(fsStatus);
            Assert.IsTrue(dsStatus);

            ls.Deactivate();
            fs.Deactivate();
            ds.Deactivate();

            Assert.IsNull(ls.alarm);
            Assert.IsNull(fs.alarm);
            Assert.IsNull(ds.alarm);
        }
예제 #2
0
        public void CheckStatusTest()
        {
            LightSensor ls       = new LightSensor();
            FireSensor  fs       = new FireSensor();
            DoorSensor  ds       = new DoorSensor();
            bool        lsStatus = ls.checkStatus();
            bool        fsStatus = fs.checkStatus();
            bool        dsStatus = ds.checkStatus();

            Assert.IsFalse(lsStatus);
            Assert.IsFalse(fsStatus);
            Assert.IsFalse(dsStatus);
        }
예제 #3
0
        public void SupressSensorTest()
        {
            LightSensor ls = new LightSensor();
            FireSensor  fs = new FireSensor();
            DoorSensor  ds = new DoorSensor();

            Alarm lsA = ls.triggerSensor();
            Alarm fsA = fs.triggerSensor();
            Alarm dsA = ds.triggerSensor();

            ls.Deactivate();
            fs.Deactivate();
            ds.Deactivate();

            bool lsStatus = ls.checkStatus();
            bool fsStatus = fs.checkStatus();
            bool dsStatus = ds.checkStatus();

            Assert.IsFalse(lsStatus);
            Assert.IsFalse(fsStatus);
            Assert.IsFalse(dsStatus);
        }