public void VehicleAppliesBrakesWhenAlarmSounds() { var vehicleBrakingSystem = new VehicleBrakingSystem(); Tyres tyres = createVehicleTyres(); TyrePressureSensorManager tyrePressureManager = new TyrePressureSensorManager(tyres, vehicleBrakingSystem); tyrePressureManager.MonitorVehicleTyres(); Assert.IsTrue(vehicleBrakingSystem.EmergencyStop); Assert.AreEqual <int>(100, vehicleBrakingSystem.BrakeForceApplied); }
public void VehicleAppliesBrakesAndNotifiesDashboardOfCurrentTyrePressureWhenAlarmSounds() { var vehicleBrakingSystem = new VehicleBrakingSystem(); var vehicleDashboard = new VehicleDashboard(); var tyrePressureAlarmPublisher = new AlarmPublisher(); tyrePressureAlarmPublisher.RegisterAlarmSubscriber(vehicleBrakingSystem); tyrePressureAlarmPublisher.RegisterAlarmSubscriber(vehicleDashboard); Tyres tyres = createVehicleTyres(); TyrePressureSensorManager tyrePressureManager = new TyrePressureSensorManager(tyres, tyrePressureAlarmPublisher); tyrePressureManager.MonitorVehicleTyres(); Assert.IsTrue(vehicleBrakingSystem.EmergencyStop); Assert.AreEqual <int>(100, vehicleBrakingSystem.BrakeForceApplied); Assert.IsNotNull(vehicleDashboard.messageToUser); Assert.IsTrue(vehicleDashboard.makeNoiseAtUser); }