Exemplo n.º 1
0
        public void Activate_GivenStateZero_ExpectAllLightShouldBeRed()
        {
            //Arrange
            var stage = new Stage(0)
            {
                Next = new Stage(1)
            };
            var startTime = DateTime.Now;

            //Act
            stage.Activate(startTime);

            //Assert
            Assert.IsTrue(stage.StartTime == startTime);
            Assert.IsTrue(stage.Lights.All(light => light.Colour == Colour.Red));
            Assert.IsTrue(stage.IsActive);
        }
Exemplo n.º 2
0
        public void Activate_GivenStateTwo_ExpectOnlyLightOneAndTwoBeGreen()
        {
            //Arrange
            var stage = new Stage(2)
            {
                Lights = Enumerable.Range(0, 4).Select(i => new Light(Colour.Red, new Position(i))).ToList()
            };

            //Act
            stage.Activate(DateTime.Now);

            //Assert
            Assert.IsTrue(stage.Lights[0].Colour == Colour.Red);
            Assert.IsTrue(stage.Lights[1].Colour == Colour.Green);
            Assert.IsTrue(stage.Lights[2].Colour == Colour.Green);
            Assert.IsTrue(stage.Lights[3].Colour == Colour.Red);
            Assert.IsTrue(stage.IsActive);
        }