예제 #1
0
        public void StartVehicle_NonDieselCar_ShouldStartVehicle()
        {
            // Arrange
            var car = new Car
                          {
                              FuelType = FuelType.Hybrid,
                              EngineState = EngineState.Stopped,
                              MessageLog = new List<string>()
                          };

            // Act
            car.StartVehicle(car);

            // Assert
            car.EngineState.Should().Be(EngineState.Started);
            car.MessageLog.Count.Should().Be(1);
        }
예제 #2
0
        public void StopVehicle_UsingJetFuel_ShouldRunEngineCoolingProcess()
        {
            // Arrange
            var car = new Car
            {
                EngineState = EngineState.Started,
                FuelType = FuelType.JetFuel,
                RadioState = RadioState.Off,
                MessageLog = new List<string>()
            };

            // Act
            car.StopVehicle(car);

            // Assert
            car.EngineState.Should().Be(EngineState.Stopped);
            car.MessageLog.Should().Contain("Cooling engine.");
        }
예제 #3
0
        public void StartVehicle_DieselCar_ShouldStartVehicleAndWarmGlowPlugs()
        {
            // Arrange
            var car = new Car
            {
                FuelType = FuelType.Diesel,
                EngineState = EngineState.Stopped,
                MessageLog = new List<string>(),
                Make = "BMW"
            };

            // Act
            car.StartVehicle(car);

            // Assert
            car.EngineState.Should().Be(EngineState.Started);
            car.MessageLog.Count.Should().Be(2);
            car.MessageLog.Should().Contain(m => m == "Warming glow-plugs.");
        }
예제 #4
0
        public void StopVehicle_WithRadioSateFM_ShouldSetRadioStateToOff()
        {
            // Arrange
            var car = new Car
            {
                EngineState = EngineState.Started,
                FuelType = FuelType.Hybrid,
                RadioState = RadioState.FM,
                MessageLog = new List<string>()
            };

            // Act
            car.StopVehicle(car);

            // Assert
            car.EngineState.Should().Be(EngineState.Stopped);
            car.RadioState.Should().Be(RadioState.Off);
        }
예제 #5
0
        public void StopVehicle_WithStartedEngine_ShouldStopVehicle()
        {
            // Arrange
            var car = new Car
                          {
                              EngineState = EngineState.Started,
                              FuelType = FuelType.Electirc,
                              RadioState = RadioState.Off,
                              MessageLog = new List<string>()
                          };

            // Act
            car.StopVehicle(car);

            // Assert
            car.EngineState.Should().Be(EngineState.Stopped);
        }