예제 #1
0
        public void ThenLamsShouldTurnedOnCorrectlyTest()
        {
            // Arrange
            const int anyHours   = 14;
            const int anySeconds = 34;
            var       clock      = new Domain.BerlinClock();

            clock.SetTime(anyHours, 59, anySeconds);

            // Act
            clock.SetTime(anyHours, 16, anySeconds);

            // Assert
            Assert.That(clock.FirstMinutesRow[0], Is.EqualTo(MinutesColor.Yellow));
            Assert.That(clock.FirstMinutesRow[1], Is.EqualTo(MinutesColor.Yellow));
            Assert.That(clock.FirstMinutesRow[2], Is.EqualTo(MinutesColor.Red));
            Assert.That(clock.FirstMinutesRow[3], Is.EqualTo(MinutesColor.None));
            Assert.That(clock.FirstMinutesRow[4], Is.EqualTo(MinutesColor.None));
            Assert.That(clock.FirstMinutesRow[5], Is.EqualTo(MinutesColor.None));
            Assert.That(clock.FirstMinutesRow[6], Is.EqualTo(MinutesColor.None));
            Assert.That(clock.FirstMinutesRow[7], Is.EqualTo(MinutesColor.None));
            Assert.That(clock.FirstMinutesRow[8], Is.EqualTo(MinutesColor.None));
            Assert.That(clock.FirstMinutesRow[9], Is.EqualTo(MinutesColor.None));
            Assert.That(clock.FirstMinutesRow[10], Is.EqualTo(MinutesColor.None));
        }
        public void ThenLamsShouldTurnedOnCorrectlyTest(int seconds, SecondsColor color)
        {
            // Arrange
            const int anyHours   = 14;
            const int anyMinutes = 34;
            var       clock      = new Domain.BerlinClock();

            clock.SetTime(anyHours, anyMinutes, seconds);

            // Act
            clock.SetTime(anyHours, anyMinutes, seconds);

            // Assert
            Assert.That(clock.SecondsRow, Is.EqualTo(color));
        }
        public void ThenLamsShouldTurnedOnCorrectlyTest(int minutes,
                                                        MinutesColor colorOfFirstLampColor    = MinutesColor.None,
                                                        MinutesColor colorOfSecondLampColor   = MinutesColor.None,
                                                        MinutesColor colorOfThirdLampColor    = MinutesColor.None,
                                                        MinutesColor colorOfForthLampColor    = MinutesColor.None,
                                                        MinutesColor colorOfFifthLampColor    = MinutesColor.None,
                                                        MinutesColor colorOfSixthLampColor    = MinutesColor.None,
                                                        MinutesColor colorOfSeventhLampColor  = MinutesColor.None,
                                                        MinutesColor colorOfEighthLampColor   = MinutesColor.None,
                                                        MinutesColor colorOfNinthLampColor    = MinutesColor.None,
                                                        MinutesColor colorOfTenthLampColor    = MinutesColor.None,
                                                        MinutesColor colorOfEleventhLampColor = MinutesColor.None)
        {
            // Arrange
            const int anyHours   = 14;
            const int anySeconds = 34;
            var       clock      = new Domain.BerlinClock();

            // Act
            clock.SetTime(anyHours, minutes, anySeconds);

            // Assert
            Assert.That(clock.FirstMinutesRow[0], Is.EqualTo(colorOfFirstLampColor));
            Assert.That(clock.FirstMinutesRow[1], Is.EqualTo(colorOfSecondLampColor));
            Assert.That(clock.FirstMinutesRow[2], Is.EqualTo(colorOfThirdLampColor));
            Assert.That(clock.FirstMinutesRow[3], Is.EqualTo(colorOfForthLampColor));
            Assert.That(clock.FirstMinutesRow[4], Is.EqualTo(colorOfFifthLampColor));
            Assert.That(clock.FirstMinutesRow[5], Is.EqualTo(colorOfSixthLampColor));
            Assert.That(clock.FirstMinutesRow[6], Is.EqualTo(colorOfSeventhLampColor));
            Assert.That(clock.FirstMinutesRow[7], Is.EqualTo(colorOfEighthLampColor));
            Assert.That(clock.FirstMinutesRow[8], Is.EqualTo(colorOfNinthLampColor));
            Assert.That(clock.FirstMinutesRow[9], Is.EqualTo(colorOfTenthLampColor));
            Assert.That(clock.FirstMinutesRow[10], Is.EqualTo(colorOfEleventhLampColor));
        }
예제 #4
0
        public void WhenSetTimeWithWrongInputParamsThenShouldBeExceptionTest(int hours, int minutes, int seconds)
        {
            // Arrange & Act
            var clock = new Domain.BerlinClock();

            // Assert
            Assert.Throws <ArgumentException>(() => clock.SetTime(hours, minutes, seconds));
        }
예제 #5
0
        public void ThenLamsShouldTurnedOnCorrectlyTest()
        {
            // Arrange
            const int anyMinutes = 34;
            const int anySeconds = 34;
            var       clock      = new Domain.BerlinClock();

            clock.SetTime(24, anyMinutes, anySeconds);

            // Act
            clock.SetTime(11, anyMinutes, anySeconds);

            // Assert
            Assert.That(clock.SecondHoursRow[0], Is.EqualTo(HoursColor.Red));
            Assert.That(clock.SecondHoursRow[1], Is.EqualTo(HoursColor.None));
            Assert.That(clock.SecondHoursRow[2], Is.EqualTo(HoursColor.None));
            Assert.That(clock.SecondHoursRow[3], Is.EqualTo(HoursColor.None));
        }
        public void ThenLamsShouldTurnedOnCorrectlyTest(int hours,
                                                        HoursColor colorOfFirstLampColor = HoursColor.None, HoursColor colorOfSecondLampColor = HoursColor.None,
                                                        HoursColor colorOfThirdLampColor = HoursColor.None, HoursColor colorOfForthLampColor  = HoursColor.None)
        {
            // Arrange
            const int anyMinutes = 34;
            const int anySeconds = 34;
            var       clock      = new Domain.BerlinClock();

            // Act
            clock.SetTime(hours, anyMinutes, anySeconds);

            // Assert
            Assert.That(clock.FirstHoursRow[0], Is.EqualTo(colorOfFirstLampColor));
            Assert.That(clock.FirstHoursRow[1], Is.EqualTo(colorOfSecondLampColor));
            Assert.That(clock.FirstHoursRow[2], Is.EqualTo(colorOfThirdLampColor));
            Assert.That(clock.FirstHoursRow[3], Is.EqualTo(colorOfForthLampColor));
        }