Esempio n. 1
0
        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);
        }
Esempio n. 2
0
        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);
        }
Esempio n. 3
0
        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);
        }