本文整理汇总了C#中IContextExpression类的典型用法代码示例。如果您正苦于以下问题:C# IContextExpression类的具体用法?C# IContextExpression怎么用?C# IContextExpression使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IContextExpression类属于命名空间,在下文中一共展示了IContextExpression类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DataBoundAssertion
protected DataBoundAssertion(IContextExpression expression)
{
if (expression == null)
throw new ArgumentNullException("expression");
_expression = expression;
}
示例2: RegexMatchAssertion
public RegexMatchAssertion(IContextExpression source, Regex regex)
: base(source)
{
if (regex == null)
throw new ArgumentNullException("regex");
_regex = regex;
}
示例3: TypeAssertion
public TypeAssertion(IContextExpression source, Type expectedType, bool byCompatibility)
: base(MaskNullExpression(source))
{
if (expectedType == null)
throw new ArgumentNullException("expectedType");
if (expectedType.IsInterface || (expectedType.IsClass && expectedType.IsAbstract))
{
//
// Interfaces and abstract classes will always have an
// ancestral relationship.
//
byCompatibility = true;
}
_expectedType = expectedType;
_byCompatibility = byCompatibility;
}
示例4: ComparisonAssertion
public ComparisonAssertion(Predicate<int> 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 */);
}
示例5: IsNullAssertion
public IsNullAssertion(IContextExpression expression)
: base(expression)
{
}
示例6: MaskNullExpression
private static IContextExpression MaskNullExpression(IContextExpression expression)
{
return expression != null
? expression
: new DelegatedContextExpression(new ContextExpressionEvaluationHandler(EvaluateToException));
}
示例7: MaskNullExpression
private static IContextExpression MaskNullExpression(IContextExpression expression)
{
return expression ?? new DelegatedContextExpression(EvaluateToException);
}
示例8: assert_is_type_compatible
public static IAssertion assert_is_type_compatible(IContextExpression binding, Type type)
{
return new TypeAssertion(binding, type, /* byCompatibility */ true);
}
示例9: assert_is_null
public static IAssertion assert_is_null(IContextExpression binding)
{
return new IsNullAssertion(binding);
}
示例10: assert_is_not_null
public static IAssertion assert_is_not_null(IContextExpression binding)
{
return new UnaryNotAssertion(assert_is_null(binding));
}
示例11: assert_greater_or_equal
public static IAssertion assert_greater_or_equal(IContextExpression binding, TypeCode type, string value)
{
return new ComparisonAssertion(ComparisonResults.GreaterOrEqual, binding, type, value);
}
示例12: assert_regex
public static IAssertion assert_regex(IContextExpression binding, string pattern, bool caseSensitive, bool dontCompile)
{
if ((pattern ?? string.Empty).Length == 0)
return StaticAssertion.False;
//
// NOTE: There is an assumption here that most uses of this
// assertion will be for culture-insensitive matches. Since
// it is difficult to imagine all the implications of involving
// a culture at this point, it seems safer to just err with the
// invariant culture settings.
//
var options = RegexOptions.CultureInvariant;
if (!caseSensitive)
options |= RegexOptions.IgnoreCase;
if (!dontCompile)
options |= RegexOptions.Compiled;
return new RegexMatchAssertion(binding, new Regex(pattern, options));
}
示例13: assert_not_equal
public static IAssertion assert_not_equal(IContextExpression binding, TypeCode type, string value)
{
return new UnaryNotAssertion(assert_equal(binding, type, value));
}
示例14: assert_lesser
public static IAssertion assert_lesser(IContextExpression binding, TypeCode type, string value)
{
return new ComparisonAssertion(ComparisonResults.Lesser, binding, type, value);
}