Esempio n. 1
0
        public void ShouldGenerateCorrectResult(int value, int adjustment, string expectedResult)
        {
            var generator     = new RowGeneratorMinutesSecond();
            var adjustedValue = value - adjustment;
            var result        = generator.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));
        }
Esempio 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);
        }
Esempio n. 6
0
 public void GivenThisIsTheMinutesSecondRow()
 {
     _minutesSecondRow = new RowGeneratorMinutesSecond();
 }