public void AddInnerZoneTest() { Zone zone = new Zone(0, "room1"); zone.AddInnerZone(1); List <Zone> zones = zone.zones; Assert.AreEqual(zones[0], zone.zones[0]); Assert.IsNotNull(zone.zones[0]); Assert.AreEqual(zone.zones[0].zoneType, Zone.ZoneType.BuildingZone); }
public void CheckSensorTest() { Zone z = new Zone(0, "Building"); z.AddInnerZone(1); z.AddInnerZone(2); z.AddInnerZone(3); z.zones[0].AddInnerZone(1); Assert.IsNotNull(z.zones[0]); Assert.IsNotNull(z.zones[1]); Assert.IsNotNull(z.zones[2]); Assert.IsNotNull(z.zones[0].zones[0]); z.zones[0].zones[0].AddSensor(0); z.zones[0].zones[0].AddSensor(1); z.zones[0].zones[0].AddSensor(2); z.zones[0].AddSensor(0); z.zones[0].AddSensor(1); z.zones[0].AddSensor(2); z.zones[1].AddSensor(0); z.zones[1].AddSensor(1); z.zones[1].AddSensor(2); z.zones[2].AddSensor(0); z.zones[2].AddSensor(1); z.zones[2].AddSensor(2); Assert.IsFalse(z.zones[0].DSensors[0].Activated); z.zones[0].DSensors[0].Activate(); z.zones[1].FSensors[0].Activate(); z.zones[2].LSensors[0].Activate(); z.zones[0].zones[0].DSensors[0].Activate(); Assert.IsTrue(z.zones[0].DSensors[0].Activated); Assert.IsTrue(z.zones[1].FSensors[0].Activated); Assert.IsTrue(z.zones[2].LSensors[0].Activated); Assert.IsTrue(z.zones[0].zones[0].DSensors[0].Activated); z.zones[1].AddInnerZone(1); z.zones[1].zones[0].AddSensor(0); z.zones[1].zones[0].AddSensor(1); z.zones[1].zones[0].AddSensor(2); z.zones[1].zones[0].DSensors[0].Activate(); z.zones[1].zones[0].AddInnerZone(1); z.zones[1].zones[0].zones[0].AddSensor(0); z.zones[1].zones[0].zones[0].AddSensor(1); z.zones[1].zones[0].zones[0].AddSensor(2); z.zones[1].zones[0].zones[0].DSensors[0].Activate(); z.zones[1].zones[0].zones[0].AddInnerZone(1); z.zones[1].zones[0].zones[0].zones[0].AddSensor(0); z.zones[1].zones[0].zones[0].AddSensor(1); z.zones[1].zones[0].zones[0].zones[0].AddSensor(2); z.zones[1].zones[0].zones[0].zones[0].DSensors[0].Activate(); List <Alarm> a = new List <Alarm>(z.CheckSensors().Item2); List <ISensor> s = new List <ISensor>(z.CheckSensors().Item1); List <int> u = new List <int>(z.CheckSensors().Item3); Assert.AreEqual(7, s.Count); Assert.AreEqual(a[0].Message, "Door Sensor Activated"); Assert.AreEqual(s[4].GetAlarm(), a[4]); }