Exemplo n.º 1
0
        public void TestVehiclePriceStrategy()
        {
            Vehicle   car    = new Car(CarBrandModel.AUDI_RS6, "V3RY-NICE", 100000, 2016, VehicleType.CAR);
            Vehicle   car2   = new Car(CarBrandModel.AUDI_SQ8, "GR3AT", 200000, 2016, VehicleType.CAR);
            CarDealer dealer = new CarDealer();


            dealer.IncreaseAllPricesByPercentage(30);
            int expected = 130000;

            Console.WriteLine(car.Price);
            Assert.AreEqual(expected, car.Price, 0.0);
        }
Exemplo n.º 2
0
        public void Execute(CarDealer dealer)
        {
            double percentage;

            while (true)
            {
                Console.Write("Specify percentage: ");
                string input = Console.ReadLine();
                if (double.TryParse(input, out percentage))
                {
                    break;
                }
            }

            dealer.IncreaseAllPricesByPercentage(percentage);
        }