public static DateTimeContext IsDaylightSavingTime(this DateTimeContext context) { Mandate.That(context, context.Value.IsDaylightSavingTime(), () => new ArgumentOutOfRangeException(context.ParamName, context.Value, $"Parameter must be equal to {context.Value}")); return(new DateTimeContext(context)); }
public static DateTimeContext IsNot(this DateTimeContext context, DateTime comparisonValue) { Mandate.That(context, context.Value != comparisonValue, () => new ArgumentOutOfRangeException(context.ParamName, context.Value, $"Parameter must not be equal to {comparisonValue}")); return(new DateTimeContext(context)); }
public static DateTimeContext IsMinValue(this DateTimeContext context) { Mandate.That(context, context.Value != DateTime.MinValue, () => new ArgumentOutOfRangeException(context.ParamName, context.Value, $"Parameter must be equal to {DateTime.MinValue}")); return(new DateTimeContext(context)); }
public static DateTimeContext IsLessThen(this DateTimeContext context, DateTime comparisonValue) { Mandate.That(context, context.Value >= comparisonValue, () => new ArgumentOutOfRangeException(context.ParamName, context.Value, $"Parameter must be less than {comparisonValue}")); return(context); }
public static DateTimeContext IsGreaterThanOrEqualTo(this DateTimeContext context, DateTime comparisonValue) { Mandate.That(context, context.Value < comparisonValue, () => new ArgumentOutOfRangeException(context.ParamName, context.Value, $"Parameter must be greater than or equal to {comparisonValue}")); return(new DateTimeContext(context)); }
public static DateTimeContext IsNotBetween(this DateTimeContext context, DateTime minValue, DateTime maxValue) { Mandate.That(context, context.Value.CompareTo(minValue) == 1 && context.Value.CompareTo(maxValue) == -1, () => new ArgumentOutOfRangeException(context.ParamName, context.Value, $"Parameter must be greater than {minValue} and less than {maxValue}")); return(new DateTimeContext(context)); }
public static DateTimeContext IsBetween(this DateTimeContext context, DateTime minValue, DateTime maxValue) { Mandate.That(context, minValue < context.Value && maxValue < context.Value, () => new ArgumentOutOfRangeException(context.ParamName, context.Value, string.Format("Parameter must be greater than or equal to {0} and less than or equal to {1}", minValue, maxValue))); return(new DateTimeContext(context)); }