IncrementProgress() 공개 메소드

Advances the progress by an increment. The progress needs to remain in valid range for this to succeed.
public IncrementProgress ( int increment = 1 ) : void
increment int 1 by default
리턴 void
        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);
        }
        public void DeterminateStepProgressNotifier_IncrementProgress()
        {
            // Setup
            var controller = new ConfigurableProgressController(null);
            const int Steps = 227; // Quite a few values for which N * (1 / N) > 1.0
            var testSubject = new DeterminateStepProgressNotifier(controller, Steps);
            List<Tuple<string, double>> expectedProgress = new List<Tuple<string, double>>();

            // Act + Verify
            int expectedValue = 0;
            int i = 0;
            while(expectedValue < Steps)
            {
                int increment = i % 2 == 0 ? 2 : 1;
                i++;
                expectedValue += increment;
                testSubject.IncrementProgress(increment);

                Assert.AreEqual(expectedValue, testSubject.CurrentValue);
            }
        }