コード例 #1
0
        public void ValidationShouldGoThroughWhenEndDateAndStartDateAreSame()
        {
            DateTime startDate = DateTime.Now;
            DateTime endDate   = startDate;

            var billDateValidationAttribute = new BillDateValidationAttribute();
            var billViewModel = new BillViewModel {
                StartFrom = startDate
            };
            var validationContext = new ValidationContext(billViewModel);

            billDateValidationAttribute.Validate(endDate, validationContext);
        }
コード例 #2
0
        public void ValidationShouldGoThroughWhenEndDateIsGreaterThanStartDate()
        {
            DateTime startDate = DateTime.Now;
            DateTime endDate   = DateTime.Now.AddDays(10);

            var billDateValidationAttribute = new BillDateValidationAttribute();
            var billViewModel = new BillViewModel {
                StartFrom = startDate
            };
            var validationContext = new ValidationContext(billViewModel);

            billDateValidationAttribute.Validate(endDate, validationContext);
        }
コード例 #3
0
        public void ShouldValidateIfEndDateIsLessThanStartDate()
        {
            DateTime startDate = DateTime.Now.AddDays(10);
            DateTime endDate   = DateTime.Now;

            var billDateValidationAttribute = new BillDateValidationAttribute();
            var billViewModel = new BillViewModel {
                StartFrom = startDate
            };
            var validationContext = new ValidationContext(billViewModel);

            billDateValidationAttribute.Validate(endDate, validationContext);
        }