Beispiel #1
0
        public void Test_PowerStation_Capacity_Decrease()
        {
            //arrange
            SimplePowerStation sps = new SimplePowerStation(20);

            //act
            sps.AddTrafficLight(new ThreeColorTrafficLight(1, 10, 200));
            //assert
            sps.CurrentPowerLevel.Should().Be(10);
        }
Beispiel #2
0
        public void Test_PowerStation_Capacity_Overload()
        {
            //arrange
            SimplePowerStation sps = new SimplePowerStation(20);

            //act
            sps.AddTrafficLight(new ThreeColorTrafficLight(1, 500, 200));
            //assert
            sps.TrafficLights.Should().BeNullOrEmpty();
        }
Beispiel #3
0
        public void Test_PowerStation_Capacity_After_TrafficLightDelete()
        {
            //arrange
            SimplePowerStation sps = new SimplePowerStation(20);

            sps.AddTrafficLight(new ThreeColorTrafficLight(2, 10, 200));
            //act
            sps.RemoveTrafficLightById(2);
            //assert
            sps.CurrentPowerLevel.Should().Be(20);
        }
Beispiel #4
0
        public void Test_PowerStation_PowerOnAllTrafficLights()
        {
            //arrange
            SimplePowerStation     sps = new SimplePowerStation(50);
            ThreeColorTrafficLight tl  = new ThreeColorTrafficLight(1, 10, 500);
            ThreeColorTrafficLight tl2 = new ThreeColorTrafficLight(2, 20, 500);

            sps.AddTrafficLight(tl);
            sps.AddTrafficLight(tl2);
            //act
            sps.PowerOnAllTrafficLights();
            //assert
            tl.IsPowerOn.Should().BeTrue();
        }