/// <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)); }
public void GetResultAsyncShouldReturnFailIfNumberIsHigherThanMax(IntegerInRange sut, [RuleContext] RuleContext context) { sut.Min = 5; sut.Max = 10; Assert.That(() => sut.GetResultAsync(20, context), Is.FailingValidationResult); }
public void GetResultAsyncShouldReturnPassIfValueIsNull(IntegerInRange sut, [RuleContext] RuleContext context) { Assert.That(() => sut.GetResultAsync(null, context), Is.PassingValidationResult); }
public void GetResultAsyncShouldReturnPassIfNumberIsInRange(IntegerInRange sut, [RuleContext] RuleContext context) { sut.Min = 5; sut.Max = 10; Assert.That(() => sut.GetResultAsync(6, context), Is.PassingValidationResult); }