public void TestThatPollMotionSensorsSucceeds() { ILocationProvider FD = new SensorAtFrontDoor(); ICableSensor MS = new MotionSensor(FD); SCCU_MS = new SecurityControlUnit <ICableSensor>(new List <ICableSensor> { MS }); Assert.IsTrue((SCCU_MS.PollSensors() == "Polled AlarmSystem.MotionSensor at the front door successfully\n" || SCCU_MS.PollSensors() == "A AlarmSystem.MotionSensor sensor was triggered at the front door\n" || SCCU_MS.PollSensors() == "Oh oh, I roam the city at night")?true:false, "TestThatPollMotionSensorsSucceeds() FAILED"); }
public void TestThatPollingMotionSensorNotBetween2200To0600Fails() { ILocationProvider FD = new SensorAtFrontDoor(); ICableSensor MS = new MotionSensor(FD); SCCU_MS = new SecurityControlUnit <ICableSensor>(new List <ICableSensor> { MS }); Assert.IsTrue((SCCU_MS.PollSensors(new TimeSpan(23, 0, 0)) == "Polled AlarmSystem.MotionSensor at the front door successfully\n" || SCCU_MS.PollSensors(new TimeSpan(23, 0, 0)) == "A AlarmSystem.MotionSensor sensor was triggered at the front door\n")?true:false, "TestThatPollingMotionSensorNotBetween2200To0600Fails() FAILED"); Assert.IsTrue((SCCU_MS.PollSensors(new TimeSpan(01, 0, 0)) == "Polled AlarmSystem.MotionSensor at the front door successfully\n" || SCCU_MS.PollSensors(new TimeSpan(23, 0, 0)) == "A AlarmSystem.MotionSensor sensor was triggered at the front door\n")?true:false, "TestThatPollingMotionSensorNotBetween2200To0600Fails() FAILED"); Assert.AreEqual("Oh oh, I roam the city at night", SCCU_MS.PollSensors(new TimeSpan(21, 0, 0))); }