예제 #1
0
 public override bool IsValid(PlateInfo plateInfo)
 {
     if (plateInfo.CustomerType != CustomerType.Diplomat && !IsNormalPlate(plateInfo.Plate))
     {
         return(false);
     }
     return(ProcessNext(plateInfo));
 }
예제 #2
0
 protected bool ProcessNext(PlateInfo plateInfo)
 {
     if (_next == null)
     {
         return(true);
     }
     return(_next.IsValid(plateInfo));
 }
예제 #3
0
        public override bool IsValid(PlateInfo plateInfo)
        {
            if (plateInfo.CustomerType != CustomerType.Advertisment && plateInfo.Plate.StartsWith("MLB"))
            {
                return(false);
            }

            return(ProcessNext(plateInfo));
        }
예제 #4
0
        public override bool IsValid(PlateInfo plateInfo)
        {
            if (plateInfo.CustomerType != CustomerType.Taxi && plateInfo.Plate.Last() == 'T')
            {
                return(false);
            }

            return(ProcessNext(plateInfo));
        }
예제 #5
0
        public override bool IsValid(PlateInfo plateInfo)
        {
            if (plateInfo.CustomerType == CustomerType.Diplomat)
            {
                return(Regex.IsMatch(plateInfo.Plate, "[A-Z]{2} \\d\\d\\d [A-Z]"));
            }

            return(ProcessNext(plateInfo));
        }
예제 #6
0
        // Question: should this method be in this class? If no: where?

        private bool IsValid(PlateInfo plateInfo)
        {
            var validator = BuildChain(
                new DiplomatValidator(),
                new NormalPlateValidator(),
                new ReservedForTaxiValidator(),
                new ReservedForAdvertismentValidator()
                );

            return(validator.IsValid(plateInfo));
        }
예제 #7
0
 public abstract bool IsValid(PlateInfo plateInfo);