public void TestZeroTimeRendition()
        {
            var lightRepresentation = CreateLightRepresentation();
            var testedRenderer      = new StringBerlinClockRenderer(lightRepresentation);
            var berlinClockData     = new BerlinClockData()
            {
                FiveHoursLightsCount   = 0,
                FiveMinutesLightsCount = 0,
                IsOneSecondLightActive = true,
                OneHourLightsCount     = 0,
                OneMinuteLightsCount   = 0
            };

            var result = testedRenderer.RenderBerlinClock(berlinClockData);

            Assert.AreEqual(LengthOfRendition, result.Length);
            Assert.AreEqual("y\r\nXXXX\r\nXXXX\r\nXXXXXXXXXXX\r\nXXXX", result);
        }
Example #2
0
        private BerlinClockLightRowsRenditions ConstructRowsFromData(BerlinClockData berlinClockData)
        {
            var rows = new BerlinClockLightRowsRenditions();

            rows.FirstRow = berlinClockData.IsOneSecondLightActive ? _lightRepresentation.YellowLight.ToString() :
                            _lightRepresentation.Off.ToString();
            rows.SecondRow = CreateLightRow(numberOfActiveLights: berlinClockData.FiveHoursLightsCount,
                                            maxNumberOfLights: BerlinClockDefinition.MaxNumberOfFiveHoursLights,
                                            activeLightRepresentation: _lightRepresentation.RedLight);
            rows.ThirdRow = CreateLightRow(numberOfActiveLights: berlinClockData.OneHourLightsCount,
                                           maxNumberOfLights: BerlinClockDefinition.MaxNumberOfOneHourLights,
                                           activeLightRepresentation: _lightRepresentation.RedLight);
            var tmpFourthRow = CreateLightRow(numberOfActiveLights: berlinClockData.FiveMinutesLightsCount,
                                              maxNumberOfLights: BerlinClockDefinition.MaxNumberOfFiveMinutesLights,
                                              activeLightRepresentation: _lightRepresentation.YellowLight);

            rows.FourthRow = MarkQuarters(aRow: tmpFourthRow,
                                          activeLightRepresentation: _lightRepresentation.YellowLight,
                                          quaterLightRepresentation: _lightRepresentation.RedLight);
            rows.FifthRow = CreateLightRow(numberOfActiveLights: berlinClockData.OneMinuteLightsCount,
                                           maxNumberOfLights: BerlinClockDefinition.MaxNumberOfOneMinuteLights,
                                           activeLightRepresentation: _lightRepresentation.YellowLight);
            return(rows);
        }