コード例 #1
0
        public void Given_Hour_When_SwitchingHourLampsState_Then_TurnsAppropriateLampsOn(int minute)
        {
            var minutesFirstRow = MinutesFirstRow.Create();

            minutesFirstRow.SetPartOfTime(minute);

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

            var lampsArray = minutesFirstRow.Lamps.ToArray();

            for (var i = 0; i < lampsArray.Length; i++)
            {
                if (i + 1 <= expectedNumberOfTurnedOnLamps)
                {
                    Assert.IsTrue(lampsArray[i]);
                }
                else
                {
                    Assert.IsFalse(lampsArray[i]);
                }
            }
        }
コード例 #2
0
        public void Given_InvalidHour_When_SwitchingHourLampsState_Then_ThrowsArgumentOutOfRangeException(int minute)
        {
            var minutesFirstRow = MinutesFirstRow.Create();

            Assert.Throws <ArgumentOutOfRangeException>(() => minutesFirstRow.SetPartOfTime(minute));
        }