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);
        }
Exemplo n.º 2
0
 public AutomaticGearBox(Speedometer speedo)
 {
     speedo.ValueChanged += SpeedoValueChanged;
 }
Exemplo n.º 3
0
 public SpeedMonitor(Speedometer speedo)
 {
     _alert = false;
     speedo.ValueChanged += SpeedoValueChanged;
 }