public void MunicipalityTaxDatabaseAgent_EnteredDatesAreValid_DatesAreValid(DateTime dateFrom, DateTime dateTo) { var municipalityTax = new MunicipalityTax() { DateFrom = dateFrom }; var datesAreValidAttribute = new DatesAreValidAttribute(); var result = datesAreValidAttribute.GetValidationResult(dateTo, new ValidationContext(municipalityTax)); Assert.True(result == ValidationResult.Success); }
public void MunicipalityTaxDatabaseAgent_EnteredDatesAreValid_DatesAreEmpty(DateTime dateFrom, DateTime dateTo) { var municipalityTax = new MunicipalityTax() { DateFrom = dateFrom }; var datesAreValidAttribute = new DatesAreValidAttribute(); var result = datesAreValidAttribute.GetValidationResult(dateTo, new ValidationContext(municipalityTax)); Assert.True(result != ValidationResult.Success); Assert.Equal("DateTo and DateFrom must be filled in", result.ErrorMessage); }
public void MunicipalityTaxDatabaseAgent_EnteredDatesAreValid_DatesAreNotValid(DateTime dateFrom, DateTime dateTo) { var municipalityTax = new MunicipalityTax() { DateFrom = dateFrom }; var datesAreValidAttribute = new DatesAreValidAttribute(); var result = datesAreValidAttribute.GetValidationResult(dateTo, new ValidationContext(municipalityTax)); Assert.True(result != ValidationResult.Success); Assert.Equal("Only daily, weekly, monthly and yearly dates are allowed", result.ErrorMessage); }