Esempio 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);
        }
Esempio 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));
 }
Esempio n. 3
0
 public void Setup()
 {
     _sut = new YearValidator();
 }
Esempio n. 4
0
 public void Setup()
 {
     _target = new YearValidator(new Defects());
 }