public void ObserverTestCase() { var speedometer = new Speedometer(); var speedMonitor = new SpeedMonitor(speedometer); var autogear = new AutomaticGearBox(speedometer); //Log speedometer.CurrentSpeed = 50; speedometer.CurrentSpeed = 10; speedometer.CurrentSpeed = 20; speedometer.CurrentSpeed = 150; Assert.IsTrue(speedMonitor.HasAlerts); }
public AutomaticGearBox(Speedometer speedo) { speedo.ValueChanged += SpeedoValueChanged; }
public SpeedMonitor(Speedometer speedo) { _alert = false; speedo.ValueChanged += SpeedoValueChanged; }