private bool ValidateMonthYear() { bool valid = false; if (DatePickerDate.SelectedDate != null) { if (MonthlyReportValidator.ValidDate(DatePickerDate.SelectedDate)) { valid = true; } } return(valid); }
public void InvalidInformationTest() { MonthlyReport monthlyReport = new MonthlyReport { IdMonthlyReport = 1, DeliveryDate = DateTime.Now, PerformedActivities = null, ResultsObtained = null, HoursCumulative = 20, Enrollment = "zS18012124", IdProject = 1 }; MonthlyReportValidator monthlyReportValidator = new MonthlyReportValidator(); ValidationResult validationResult = monthlyReportValidator.Validate(monthlyReport); int errors = validationResult.Errors.Count; Assert.AreNotEqual(errors, 0); }
public void ValidInformationTest() { MonthlyReport monthlyReport = new MonthlyReport { IdMonthlyReport = 1, DeliveryDate = DateTime.Now, PerformedActivities = "Acordar con la organización vinculada las tareas que se realizarán", ResultsObtained = "Documento de calendario de actividades", HoursReported = 20, HoursCumulative = 20, Enrollment = "zS18012124", IdProject = 1 }; MonthlyReportValidator monthlyReportValidator = new MonthlyReportValidator(); ValidationResult validationResult = monthlyReportValidator.Validate(monthlyReport); Assert.IsTrue(validationResult.IsValid); }
private bool IsValidData() { bool isValid = false; MonthlyReportValidator monthlyReportDataValidator = new MonthlyReportValidator(); ValidationResult dataValidationResult = monthlyReportDataValidator.Validate(_monthlyReport); IList <ValidationFailure> validationFailures = dataValidationResult.Errors; UserFeedback userFeedback = new UserFeedback(FormGrid, validationFailures); userFeedback.ShowFeedback(); if (ValidateQuestions() && dataValidationResult.IsValid && ValidateMonthYear() && ValidateHours()) { foreach (ValidationFailure v in validationFailures) { Console.WriteLine(v); } isValid = true; } return(isValid); }