Пример #1
0
        public ComparisonAssertion(ComparisonResultPredicate predicate, IContextExpression source, TypeCode type, string value) :
            base(source)
        {
            if (predicate == null)
            {
                throw new ArgumentNullException("predicate");
            }

            _predicate = predicate;

            if (type == TypeCode.DBNull ||
                type == TypeCode.Empty ||
                type == TypeCode.Object)
            {
                string message = string.Format(
                    "The {0} value type is invalid for a comparison.", type.ToString());
                throw new ArgumentException(message, "type");
            }

            //
            // Convert the expected value to the comparison type and
            // save it as a field.
            //

            _expectedValue = Convert.ChangeType(value, type /*, FIXME CultureInfo.InvariantCulture */);
        }
Пример #2
0
        public ComparisonAssertion(ComparisonResultPredicate predicate, IContextExpression source, TypeCode type, string value)
            : base(source)
        {
            if (predicate == null)
                throw new ArgumentNullException("predicate");

            _predicate = predicate;

            if (type == TypeCode.DBNull
                || type == TypeCode.Empty
                || type == TypeCode.Object)
            {
                string message = string.Format(
                    "The {0} value type is invalid for a comparison.", type.ToString());
                throw new ArgumentException(message, "type");
            }

            //
            // Convert the expected value to the comparison type and
            // save it as a field.
            //

            _expectedValue = Convert.ChangeType(value, type/*, FIXME CultureInfo.InvariantCulture */);
        }