Beispiel #1
0
        /// <summary>
        /// Given two paths, they should both be dates,
        /// and the left-side should be either null or later than the right
        /// </summary>
        public static INamedPredicate BeNullOrAfter(dynamic checkPath)
        {
            Check.Result result  = checkPath[Should.BeAnything];
            var          date    = result.ValueChecked as DateTime?;
            var          message = result.Path;

            return(new NamedPredicate(o => DateIsNullOrAfter(o, date), "should be null or after " + message));
        }
Beispiel #2
0
        /// <summary>
        /// Given two paths, they should both be dates,
        /// and the left-side should be later than the right
        /// </summary>
        public static INamedPredicate BeAfter(dynamic checkPath)
        {
            Check.Result result  = checkPath[Should.BeAnything];
            var          date    = result.ValueChecked as DateTime?;
            var          message = result.Path;

            if (date == null)
            {
                return(new NamedPredicate(o => false, "expected a date"));
            }
            return(new NamedPredicate(o => DateIsAfter(o, date.Value), "should be after " + message));
        }