SonarLint.VisualStudio.Progress.Controller.DeterminateStepProgressNotifier.NotifyIncrementedProgress C# (CSharp) Method

NotifyIncrementedProgress() public method

Increments and notifies the progress with a message
public NotifyIncrementedProgress ( string message, int increment = 1 ) : void
message string
increment int
return void
        public void NotifyIncrementedProgress(string message, int increment = 1)
        {
            this.IncrementProgress(increment);
            this.NotifyCurrentProgress(message);
        }

Usage Example

        public void DeterminateStepProgressNotifier_NotifyIncrementedProgress()
        {
            // Setup
            var controller = new ConfigurableProgressController(null);
            const int Steps = 11; // there are two numbers (9 and 11) 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
            for (int i = 0; i < Steps; i++)
            {
                int incrementedStepValue = i + 1;
                double progress = incrementedStepValue == Steps ? 1.0 : (double)incrementedStepValue / Steps;
                expectedProgress.Add(Tuple.Create("hello world " + i, progress));

                Assert.AreEqual(i, testSubject.CurrentValue);
                testSubject.NotifyIncrementedProgress(expectedProgress.Last().Item1);
                Assert.AreEqual(incrementedStepValue, testSubject.CurrentValue);

                controller.AssertProgressChangeEvents(expectedProgress);
            }
        }
All Usage Examples Of SonarLint.VisualStudio.Progress.Controller.DeterminateStepProgressNotifier::NotifyIncrementedProgress