public PoliceCar Create(int mileage, bool serviceRequired)
		{
			PoliceCar policeCar = new PoliceCar();
			policeCar.ReadForService = serviceRequired;
			policeCar.Mileage = mileage;
			return policeCar;
		}
Ejemplo n.º 2
0
        /// <summary>
        /// runnning a car by catType
        /// </summary>
        /// <param name="carType">car</param>
        /// <returns>if catType found return true, else return false.</returns>
        public static bool RunCar(string carType)
        {
            ICar car = null;

            switch (carType)
            {
            case "FireEngine":
                car = new FireEngine();
                break;

            case "Bus":
                car = new Bus();
                break;

            case "PoliceCar":
                car = new PoliceCar();
                return(true);

            default:
                return(false);
            }

            car.Run();
            return(true);
        }
Ejemplo n.º 3
0
        static void Main(string[] args)
        {
            PoliceCar p = new PoliceCar();

            p.Emergency();
            p.LandVehicle();
        }
Ejemplo n.º 4
0
        public static void PoliceCarStatus()
        {
            var policeCar = new PoliceCar();

            policeCar.EmergencyPrintStatus();
            policeCar.LandVehiclePrintStatus();
        }
		public PoliceCar New(int mileage, bool serviceRequired)
		{
			PoliceCar policeCar = new PoliceCar();
			policeCar.ServiceRequired = serviceRequired;
			policeCar.Mileage = mileage;

			return policeCar;
		}
        public PoliceCar Create(int mileage, bool serviceRequired)
        {
            PoliceCar policeCar = new PoliceCar();

            policeCar.ReadForService = serviceRequired;
            policeCar.Mileage        = mileage;
            return(policeCar);
        }
Ejemplo n.º 7
0
        public PoliceCar New(int mileage, bool serviceRequired)
        {
            PoliceCar policeCar = new PoliceCar();

            policeCar.Mileage         = mileage;
            policeCar.requiresService = serviceRequired;

            return(policeCar);
        }
Ejemplo n.º 8
0
        /// <summary>
        /// runnning a car by catType
        /// </summary>
        /// <param name="carType">car</param>
        /// <returns>if catType found return true, else return false.</returns>
        public static bool RunCar(string carType)
        {
            switch (carType)
            {
            case "FireEngine":
                FireEngine fire = new FireEngine();
                fire.RunFireEngine();
                return(true);

            case "Bus":
                Bus bus = new Bus();
                bus.RunBus();
                return(true);

            case "PoliceCar":
                PoliceCar police = new PoliceCar();
                police.RunPoliceCar();
                return(true);

            default:
                return(false);
            }
        }
Ejemplo n.º 9
0
 public void CreatePoliceCarTest()
 {
     Car car = new PoliceCar(0, 0, 0, 0, "police");
     Assert.IsNotNull(car);
 }
Ejemplo n.º 10
0
 public void GetPoliceCarResourceTest()
 {
     Car car = new PoliceCar(0, 0, 0, 0, "police");
     string actualString = car.GetCarImageResource();
     string shouldBeString = "image_police_car.png";
     Assert.AreEqual(shouldBeString, actualString);
 }