public void GivenThisIsABerlinClock() { _topSeconds = new RowGeneratorSeconds(); _hoursFirstRow = new RowGeneratorHoursFirst(); _hoursSecondRow = new RowGeneratorHoursSecond(); _minutesFirstRow = new RowGeneratorMinutesFirst(); _minuesSecondRow = new RowGeneratorMinutesSecond(); _berlinClockGenerator = new BerlinClockGenerator(_hoursFirstRow, _hoursSecondRow, _minutesFirstRow, _minuesSecondRow, _topSeconds); }
public BerlinClockViewModel() { _clock = new BerlinClockGenerator(); _timer = new DispatcherTimer { Interval = new TimeSpan(0, 0, 0, 0, 5) }; _timer.Tick += TimerTick; _timer.Start(); }
public void ShouldReturnTheRightValue(int hours, int minutes, int seconds, string expectedResult) { var hoursFirstRow = new RowGeneratorHoursFirst(); var hourSecondRow = new RowGeneratorHoursSecond(); var minuteFirstRow = new RowGeneratorMinutesFirst(); var minuteecondRow = new RowGeneratorMinutesSecond(); var topSeconds = new RowGeneratorSeconds(); var clock = new BerlinClockGenerator(hoursFirstRow, hourSecondRow, minuteFirstRow, minuteecondRow, topSeconds); var result = clock.Generate(hours, minutes, seconds); Assert.That(result, Is.EqualTo(expectedResult)); }
public string ConvertRegularTimeToBerlinUhrTime(string time) { var tsTime = TimeSpan.Parse(time); _topYellowLamp = new RowGeneratorSeconds(); _topFirstRow = new RowGeneratorHoursFirst(); _topSecondRow = new RowGeneratorHoursSecond(); _bottomFirstRow = new RowGeneratorMinutesFirst(); _bottomSecondRow = new RowGeneratorMinutesSecond(); _berlinClockGenerator = new BerlinClockGenerator(_topFirstRow, _topSecondRow, _bottomFirstRow, _bottomSecondRow, _topYellowLamp); return(_berlinClockGenerator.Generate(tsTime.Hours, tsTime.Minutes, tsTime.Seconds)); }
public string ConvertTime(string actualTime) { var tsTime = TimeSpan.Parse(actualTime); _topYellowLamp = new RowGeneratorSeconds(); _topFirstRow = new RowGeneratorHoursFirst(); _topSecondRow = new RowGeneratorHoursSecond(); _bottomFirstRow = new RowGeneratorMinutesFirst(); _bottomSecondRow = new RowGeneratorMinutesSecond(); _berlinClockGenerator = new BerlinClockGenerator(_topFirstRow, _topSecondRow, _bottomFirstRow, _bottomSecondRow, _topYellowLamp); var result = _berlinClockGenerator.Generate(tsTime.Hours, tsTime.Minutes, tsTime.Seconds); return(result); }
public void ShouldConvertDateTimeToCorrectFormat() { const string expectedResult = "Y\r\nAAAA\r\nBBBB\r\nCCCCCCCCCCC\r\nDDDD"; var topFirstRow = MockRepository.Mock <IRowGenerator>(); var topSecondRow = MockRepository.Mock <IRowGenerator>(); var bottomFirstRow = MockRepository.Mock <IRowGenerator>(); var bottomSecondRow = MockRepository.Mock <IRowGenerator>(); var yellowLampGen = MockRepository.Mock <IRowGenerator>(); topFirstRow.Expect(x => x.Generate(0)).Return("AAAA"); topSecondRow.Expect(x => x.Generate(0)).Return("BBBB"); bottomFirstRow.Expect(x => x.Generate(0)).Return("CCCCCCCCCCC"); bottomSecondRow.Expect(x => x.Generate(0)).Return("DDDD"); yellowLampGen.Expect(x => x.Generate(0)).Return("Y"); var clock = new BerlinClockGenerator(topFirstRow, topSecondRow, bottomFirstRow, bottomSecondRow, yellowLampGen); var result = clock.Generate(new DateTime(1, 1, 1, 0, 0, 0)); Assert.That(result, Is.EqualTo(expectedResult)); }