public IncrementProgress ( int increment = 1 ) : void | ||
increment | int | 1 by default |
Результат | void |
public void IncrementProgress(int increment = 1)
{
if (increment < 1)
{
throw new ArgumentOutOfRangeException(nameof(increment));
}
if (this.currentValue + increment > this.maxNumberOfIncrements)
{
throw new ArgumentOutOfRangeException(nameof(increment), this.currentValue + increment, string.Format(CultureInfo.CurrentCulture, ControllerResources.InclusiveRangeExpectedExceptionMessage, 1, this.maxNumberOfIncrements));
}
this.currentValue += increment;
}
public void DeterminateStepProgressNotifier_IncrementProgress_ArgChecks() { // Setup var testSubject = new DeterminateStepProgressNotifier(new ConfigurableProgressController(null), 11); Exceptions.Expect<ArgumentOutOfRangeException>(() => testSubject.IncrementProgress(0)); Exceptions.Expect<ArgumentOutOfRangeException>(() => testSubject.IncrementProgress(-1)); Exceptions.Expect<ArgumentOutOfRangeException>(() => testSubject.IncrementProgress(12)); // Check successful case (the last valid one) testSubject.IncrementProgress(11); Assert.AreEqual(11, testSubject.CurrentValue); }