Exemplo n.º 1
0
        public void GenerateCorrectZeroHour(int hour, int adjustment, string expectedResult)
        {
            var hourGenerator = new RowGeneratorHoursSecond();
            var adjustedValue = hour - adjustment;
            var result        = hourGenerator.Generate(adjustedValue);

            Assert.That(result, Is.EqualTo(expectedResult));
        }
 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 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));
        }
Exemplo n.º 5
0
        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 GivenTheTopSecondRowConsistingOfFourRedLamps()
 {
     _topSecondRow = new RowGeneratorHoursSecond();
 }