Esempio n. 1
0
        public void Given_Hour_When_SwitchingHourLampsState_Then_TurnsAppropriateLampsOn(int hour)
        {
            var hoursFirstRow = HoursFirstRow.Create();

            hoursFirstRow.SetPartOfTime(hour);

            var expectedNumberOfTurnedOnLamps = (hour - (hour % TIME_UNIT_INTERVAL)) / TIME_UNIT_INTERVAL;

            var lampsArray = hoursFirstRow.Lamps.ToArray();

            for (var i = 0; i < lampsArray.Length; i++)
            {
                if (i + 1 <= expectedNumberOfTurnedOnLamps)
                {
                    Assert.IsTrue(lampsArray[i]);
                }
                else
                {
                    Assert.IsFalse(lampsArray[i]);
                }
            }
        }
Esempio n. 2
0
        public void Given_InvalidHour_When_SwitchingHourLampsState_Then_ThrowsArgumentOutOfRangeException(int hour)
        {
            var hoursFirstRow = HoursFirstRow.Create();

            Assert.Throws <ArgumentOutOfRangeException>(() => hoursFirstRow.SetPartOfTime(hour));
        }