本文整理汇总了C#中ValidatableArgument.IsLessThan方法的典型用法代码示例。如果您正苦于以下问题:C# ValidatableArgument.IsLessThan方法的具体用法?C# ValidatableArgument.IsLessThan怎么用?C# ValidatableArgument.IsLessThan使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ValidatableArgument
的用法示例。
在下文中一共展示了ValidatableArgument.IsLessThan方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AddLessThanValidationPredicate_WhenArgumentIsDecimal
public void AddLessThanValidationPredicate_WhenArgumentIsDecimal()
{
// Arrange.
ValidatableArgument<decimal> argument = new ValidatableArgument<decimal>("argument", 3);
// Act.
argument.IsLessThan(5);
// Assert.
Assert.AreEqual(1, argument.ValidationPredicates.Count());
Assert.IsInstanceOfType(argument.ValidationPredicates.First(), typeof(LessThanValidationPredicate<decimal>));
}
示例2: NotThrowAnyException_WhenArgumentHasNoMatches
public void NotThrowAnyException_WhenArgumentHasNoMatches()
{
// Arrange.
IValidatableArgument<int> validatableArgument = new ValidatableArgument<int>("validatableArgument", 3);
validatableArgument.IsLessThan(2).IsGreaterThan(5);
// Act & Assert.
Ensure.NoExceptionIsThrown(
() =>
{
validatableArgument.Throw();
});
}
示例3: ReturnFalseAndArgumentExceptionIsNull_WhenArgumentDoesNotHaveMatches
public void ReturnFalseAndArgumentExceptionIsNull_WhenArgumentDoesNotHaveMatches()
{
// Arrange.
IValidatableArgument<int> validatableArgument = new ValidatableArgument<int>("validatableArgument", 3);
validatableArgument.IsLessThan(2).IsGreaterThan(5);
// Act.
ArgumentException argumentException;
bool result = validatableArgument.TryGetArgumentException(out argumentException);
// Assert.
Assert.IsFalse(result);
Assert.IsNull(argumentException);
}
示例4: ReturnTrueAndCreatesArgumentOutOfRangeException_WhenArgumentHasMatchesOfRangeValidationType
public void ReturnTrueAndCreatesArgumentOutOfRangeException_WhenArgumentHasMatchesOfRangeValidationType()
{
// Arrange.
IValidatableArgument<int> validatableArgument = new ValidatableArgument<int>("validatableArgument", 3);
validatableArgument.IsLessThan(5).IsGreaterThan(2);
// Act.
ArgumentException argumentException;
bool result = validatableArgument.TryGetArgumentException(out argumentException);
// Assert.
Assert.IsTrue(result);
Assert.IsNotNull(argumentException);
Assert.IsInstanceOfType(argumentException, typeof(ArgumentOutOfRangeException));
Assert.AreEqual("validatableArgument", argumentException.ParamName);
Assert.AreEqual("Argument value <3> is less than <5>.\r\nParameter name: validatableArgument", argumentException.Message);
}
示例5: RunInExpectedTime
public void RunInExpectedTime()
{
// Arrange.
ValidatableArgument<int> argument = new ValidatableArgument<int>("argument", 3);
// Act & Assert.
Ensure.ActionRunsInExpectedTime(
() =>
{
argument.IsLessThan(3);
},
PerformanceConstants.ValidationPredicateExecutionCount,
PerformanceConstants.ValidationPredicateTotalExecutionExpectedTime);
}
示例6: AddLessThanValidationPredicate_WhenArgumentIsDateTime
public void AddLessThanValidationPredicate_WhenArgumentIsDateTime()
{
// Arrange.
ValidatableArgument<DateTime> argument = new ValidatableArgument<DateTime>("argument", DateTime.Now);
// Act.
argument.IsLessThan(DateTime.Now);
// Assert.
Assert.AreEqual(1, argument.ValidationPredicates.Count());
Assert.IsInstanceOfType(argument.ValidationPredicates.First(), typeof(LessThanValidationPredicate<DateTime>));
}