protected AVehicle(string make, string model, decimal price)
        {
            CustomValidator.ValidateStringRange(make, Constants.MinMakeLength, Constants.MaxMakeLength, Constants.StringMustBeBetweenMinAndMax);
            CustomValidator.ValidateStringRange(model, Constants.MinModelLength, Constants.MaxModelLength, Constants.StringMustBeBetweenMinAndMax);
            CustomValidator.ValidateDecimalRange(price, Constants.MinPrice, Constants.MaxPrice, Constants.NumberMustBeBetweenMinAndMax);
            this.Make  = make;
            this.Model = model;
            this.Price = price;

            this.Type = (VehicleType)Enum.Parse(typeof(VehicleType), this.GetType().Name);

            //TODO: The Wheels Constant for Validation IS used! But does a redundant or out of place validation.
            CustomValidator.ValidateIntRange((int)this.Type, Constants.MinWheels, Constants.MaxWheels, Constants.NumberMustBeBetweenMinAndMax);
            this.Wheels = (int)this.Type;
        }
Exemplo n.º 2
0
 public Truck(string make, string model, decimal price, int weightCapacity) : base(make, model, price)
 {
     CustomValidator.ValidateIntRange(weightCapacity, Constants.MinCapacity, Constants.MaxCapacity, Constants.NumberMustBeBetweenMinAndMax);
     this.WeightCapacity = weightCapacity;
 }
Exemplo n.º 3
0
 public Car(string make, string model, decimal price, int seats) : base(make, model, price)
 {
     CustomValidator.ValidateIntRange(seats, Constants.MinSeats, Constants.MaxSeats, Constants.NumberMustBeBetweenMinAndMax);
     this.Seats = seats;
 }