Esempio n. 1
0
 public void GivenIImplementTheClassSystemTimeApiAndISubscribeToTheEventOnHourChanged()
 {
     _systemTimeApi = new BerlinClock.Api.SystemTimeApi();
     _systemTimeApi.OnShortTimeUpdate += (x) => _shortDate = x;
     _systemTimeApi.OnSecondChanged   += (x) => _second = x;
     _systemTimeApi.OnMinuteChanged   += (x) => _minute = x;
     _systemTimeApi.OnHourChanged     += (x) => _hour = x;
 }
 public BerlinClockApi(IRow4Lights row5Hours, IRow4Lights row1Hour,
                       IRow11Lights row5Minutes, IRow4Lights row1Minute, ISystemTimeApi systemTimeApi)
 {
     // Implementations
     _row5Hours     = row5Hours;
     _row1Hour      = row1Hour;
     _row5Minutes   = row5Minutes;
     _row1Minute    = row1Minute;
     _systemTimeApi = systemTimeApi;
     // Row events
     _row5Hours.OnRowChanged   += (x) => this.OnRow5HoursChanged?.Invoke(x);
     _row1Hour.OnRowChanged    += (x) => this.OnRow1HourChanged?.Invoke(x);
     _row5Minutes.OnRowChanged += (x) => this.OnRow5MinutesChanged?.Invoke(x);
     _row1Minute.OnRowChanged  += (x) => this.OnRow1MinuteChanged?.Invoke(x);
     // Time events
     _systemTimeApi.OnShortTimeUpdate += (x) => this.OnShortTimeUpdated?.Invoke(x);
     _systemTimeApi.OnSecondChanged   += SecondChanged;
     _systemTimeApi.OnMinuteChanged   += MinuteChanged;
     _systemTimeApi.OnHourChanged     += HourChanged;
 }