Ejemplo n.º 1
0
        public static void IsBetween <T>([NotNull] this Guardian source, Expression <Func <T> > expression, T minLimit, T maxLimit, IComparer <T> comparer)
        {
            source.IsNotNull(expression, nameof(expression));

            var(value, parameterName) = ((IGuardian)source).ExtractValueAndParameterNameFromExpression(expression);
            IsLowerThan(source, value, parameterName, maxLimit, comparer);
        }
Ejemplo n.º 2
0
        public static void IsGreaterThanOrEqualToZero([NotNull] this Guardian source, [NotNull] Expression <Func <double> > expression)
        {
            source.IsNotNull(expression, nameof(expression));

            var(value, parameterName) = ((IGuardian)source).ExtractValueAndParameterNameFromExpression(expression);
            IsGreaterThanOrEqualToZero(source, value, parameterName);
        }
        public static void IsStrictlyBetween <T>([NotNull] this Guardian source, [NotNull] Expression <Func <T> > expression, T minLimit, T maxLimit)
        {
            source.IsNotNull(expression, nameof(expression));

            var(value, parameterName) = ((IGuardian)source).ExtractValueAndParameterNameFromExpression(expression);
            IsStrictlyBetween(source, value, parameterName, minLimit, maxLimit);
        }
Ejemplo n.º 4
0
        public static void IsGreaterThanOrEqualTo <T>([NotNull] this Guardian source, [NotNull] Expression <Func <T> > expression, T minLimit, [NotNull] IComparer <T> comparer)
        {
            source.IsNotNull(expression, nameof(expression));

            var(value, parameterName) = ((IGuardian)source).ExtractValueAndParameterNameFromExpression(expression);
            IsGreaterThanOrEqualTo(source, value, parameterName, minLimit, comparer);
        }
        public static void IsNotEmptyGuid([NotNull] this Guardian source, [NotNull] Expression <Func <Guid> > expression)
        {
            source.IsNotNull(expression, nameof(expression));

            var(value, parameterName) = ((IGuardian)source).ExtractValueAndParameterNameFromExpression(expression);
            IsNotEmptyGuid(source, value, parameterName);
        }
Ejemplo n.º 6
0
        public static void Exists([NotNull] this Guardian source, [NotNull] Expression <Func <FileSystemInfo> > expression)
        {
            source.IsNotNull(expression, nameof(expression));

            var(fileSystemInfo, parameterName) = ((IGuardian)source).ExtractValueAndParameterNameFromExpression(expression);
            Exists(source, fileSystemInfo, parameterName);
        }
        public static void IsEqualTo <T>([NotNull] this Guardian source, [NotNull] Expression <Func <T> > expression, T referenceValue)
        {
            source.IsNotNull(expression, nameof(expression));

            var(value, parameterName) = ((IGuardian)source).ExtractValueAndParameterNameFromExpression(expression);
            IsEqualTo(source, value, parameterName, referenceValue);
        }
#pragma warning disable CS3024 // Constraint type is not CLS-compliant
        public static void IsDefined <TEnum>([NotNull] this Guardian source, [NotNull] Expression <Func <TEnum> > expression)
#pragma warning restore CS3024 // Constraint type is not CLS-compliant
            where TEnum : struct, IConvertible
        {
            source.IsNotNull(expression, nameof(expression));

            var(value, parameterName) = ((IGuardian)source).ExtractValueAndParameterNameFromExpression(expression);
            IsDefined(source, value, parameterName);
        }
Ejemplo n.º 9
0
        public static void Exists([NotNull] this Guardian source, [NotNull] FileSystemInfo file, string parameterName)
        {
            source.IsNotNull(file, nameof(file));

            file.Refresh();
            if (!file.Exists)
            {
                throw new FileNotFoundException(Messages.ExistsNotFoundFormat(parameterName), file.FullName);
            }
        }