public void AlarmFiresWhenTyrePressureFallsOutOfSetRange() { var alarmListener = new MockAlarmListener(); Tyres tyres = createVehicleTyres(); TyrePressureSensorManager tyrePressureManager = new TyrePressureSensorManager(tyres, alarmListener); tyrePressureManager.MonitorVehicleTyres(); Assert.IsTrue(alarmListener.AlarmTriggeredCalled, "alarm triggered"); }
public void VehicleCanMonitorPressureOnIndividualTyres() { var mockAlarmListener = new MockAlarmListener(); var monitoredTyre = new MonitoredTyre(new Tyre(), mockAlarmListener); Thread t = new Thread(new ThreadStart(monitoredTyre.InitialiseMonitoring)); t.Start(); int currentPressure = monitoredTyre.GetCurrentPressure(); Assert.IsNotNull(monitoredTyre.GetCurrentPressure()); Assert.IsTrue(mockAlarmListener.AlarmTriggeredCalled); }