Beispiel #1
0
        private bool ValidId(SchoolVan aSchoolVan)
        {
            bool validationId = true;

            if (aSchoolVan.Id < min_id)
            {
                validationId = false;
            }
            return(validationId);
        }
Beispiel #2
0
        public bool IsValid(object anObject)
        {
            SchoolVan theSchoolVan = anObject as SchoolVan;

            if ((System.Object)theSchoolVan == null)
            {
                throw new InvalidObjectAddIntoSchoolVanException("Se esperaba un objeto del tipo [SchoolVan]");
            }
            return(AllAtributesAreValid(theSchoolVan));
        }
Beispiel #3
0
        private bool ValidFuelConsumption(SchoolVan aSchoolVan)
        {
            bool fuelValidation = true;

            if (aSchoolVan.FuelConsumption <= min_fuelConsumption)
            {
                fuelValidation = false;
            }
            return(fuelValidation);
        }
Beispiel #4
0
        private bool ValidCapacity(SchoolVan aSchoolVan)
        {
            bool validationCapacity = true;

            if (!(aSchoolVan.Capacity >= min_capacity && aSchoolVan.Capacity <= max_capacity))
            {
                validationCapacity = false;
            }
            return(validationCapacity);
        }
Beispiel #5
0
        public override bool Equals(object aSchoolVan)
        {
            SchoolVan theSchoolVan = aSchoolVan as SchoolVan;

            if ((System.Object)theSchoolVan == null)
            {
                return(false);
            }
            return(this.Id == theSchoolVan.Id);
        }
Beispiel #6
0
        private bool AllAtributesAreValid(SchoolVan theSchoolVan)
        {
            bool capacityValidation = ValidCapacity(theSchoolVan);

            if (!capacityValidation)
            {
                throw new InvalidValueException("La camioneta debe tener la capacidad entre [" + min_capacity + "-" + max_capacity + "]");
            }
            bool idValidation = ValidId(theSchoolVan);

            if (!idValidation)
            {
                throw new EmptyOrNullValueException("El id debe ser mayor a " + min_id);
            }
            bool fuelConsumptionValidation = ValidFuelConsumption(theSchoolVan);

            if (!fuelConsumptionValidation)
            {
                throw new InvalidValueException("La camioneta debe tener un consumo mayor a " + min_fuelConsumption);
            }
            return(capacityValidation && idValidation && fuelConsumptionValidation);
        }
Beispiel #7
0
 public Route()
 {
     theRoute     = new List <IRouteObject>();
     theSchoolVan = new SchoolVan();
 }