コード例 #1
0
 /// <summary>
 /// Initialises a new instance of <see cref="CountInRange{T}"/>.
 /// </summary>
 /// <param name="inRangeRule">A number-in-range rule.</param>
 /// <exception cref="ArgumentNullException">If <paramref name="inRangeRule"/> is <see langword="null" />.</exception>
 public CountInRange(IntegerInRange inRangeRule)
 {
     this.inRangeRule = inRangeRule ?? throw new ArgumentNullException(nameof(inRangeRule));
 }
コード例 #2
0
 public void GetResultAsyncShouldReturnFailIfNumberIsHigherThanMax(IntegerInRange sut, [RuleContext] RuleContext context)
 {
     sut.Min = 5;
     sut.Max = 10;
     Assert.That(() => sut.GetResultAsync(20, context), Is.FailingValidationResult);
 }
コード例 #3
0
 public void GetResultAsyncShouldReturnPassIfValueIsNull(IntegerInRange sut, [RuleContext] RuleContext context)
 {
     Assert.That(() => sut.GetResultAsync(null, context), Is.PassingValidationResult);
 }
コード例 #4
0
 public void GetResultAsyncShouldReturnPassIfNumberIsInRange(IntegerInRange sut, [RuleContext] RuleContext context)
 {
     sut.Min = 5;
     sut.Max = 10;
     Assert.That(() => sut.GetResultAsync(6, context), Is.PassingValidationResult);
 }