static void Main(string[] args) { var theTimeNow = DateTime.Now; var clock = new BerlinClock(); Console.WriteLine("The berlin clock for {0} is ...\n", theTimeNow.ToString("hh:MM:ss")); Console.WriteLine(clock.Generate(theTimeNow)); Console.ReadLine(); }
public void ShouldReturnTheRightValue(int hours, int minutes, int seconds, string expectedResult) { var topFirstRow = new RowGeneratorTopFirst(); var topSecondRow = new RowGeneratorTopSecond(); var bottomFirstRow = new RowGeneratorBottomFirst(); var bottomSecondRow = new RowGeneratorBottomSecond(); var yellowLampGen = new RowGeneratorYellowLamp(); var clock = new BerlinClock(topFirstRow, topSecondRow, bottomFirstRow, bottomSecondRow, yellowLampGen); var result = clock.Generate(hours, minutes, seconds); Assert.That(result, Is.EqualTo(expectedResult)); }
public void ShouldConvertDateTimeToCorrectFormat() { const string expectedResult = "Y\nAAAA\nBBBB\nCCCCCCCCCCC\nDDDD"; var topFirstRow = MockRepository.GenerateStub <IRowGenerator>(); var topSecondRow = MockRepository.GenerateStub <IRowGenerator>(); var bottomFirstRow = MockRepository.GenerateStub <IRowGenerator>(); var bottomSecondRow = MockRepository.GenerateStub <IRowGenerator>(); var yellowLampGen = MockRepository.GenerateStub <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 BerlinClock(topFirstRow, topSecondRow, bottomFirstRow, bottomSecondRow, yellowLampGen); var result = clock.Generate(new DateTime(1, 1, 1, 0, 0, 0)); Assert.That(result, Is.EqualTo(expectedResult)); }