Exemplo n.º 1
0
        public Defects Validate(FileModel file, List <YearlyData> records)
        {
            Defects defects = new Defects {
                FileName = file.Name
            };

            if (records == null || !records.Any())
            {
                defects.Errors.Add("No data found in file.");
                return(defects);
            }

            YearValidator yearValidator = new YearValidator(defects);

            foreach (var record in records)
            {
                defects = yearValidator.Validate(record);
            }

            ProductNameValidator productNameValidator = new ProductNameValidator(defects);

            foreach (var record in records)
            {
                defects = productNameValidator.Validate(record);
            }

            defects = new ProductName().FindDifferentCasing(defects, records);

            return(defects);
        }
Exemplo n.º 2
0
 protected override bool ValidateDate(int year, int month, int day)
 {
     return(DayValidator.ValidDay(day, month, year) && MonthValidator.ValidMonth(month) &&
            YearValidator.ValidYear(year));
 }
Exemplo n.º 3
0
 public void Setup()
 {
     _sut = new YearValidator();
 }
Exemplo n.º 4
0
 public void Setup()
 {
     _target = new YearValidator(new Defects());
 }