SonarLint.VisualStudio.Progress.UnitTests.ConfigurableProgressEvents.InvokeFinished C# (CSharp) Method

InvokeFinished() public method

public InvokeFinished ( ProgressControllerResult result ) : void
result ProgressControllerResult
return void
        public void InvokeFinished(ProgressControllerResult result)
        {
            if (this.Finished != null)
            {
                this.Finished(this, new ProgressControllerFinishedEventArgs(result));
            }
        }

Usage Example

        public void Helpers_RunOnFinished()
        {
            // Setup
            ConfigurableProgressEvents progressEvents = new ConfigurableProgressEvents();
            ProgressControllerResult? result = null;
            Action<ProgressControllerResult> action = (r) => result = r;

            foreach (ProgressControllerResult progressResult in Enum.GetValues(typeof(ProgressControllerResult)))
            {
                result = null;
                Helpers.RunOnFinished(progressEvents, action);

                // Act
                progressEvents.InvokeFinished(progressResult);

                // Verify
                Assert.AreEqual(progressResult, result, "Action was not called");
                progressEvents.AssertAllEventsAreUnregistered();
            }
        }
All Usage Examples Of SonarLint.VisualStudio.Progress.UnitTests.ConfigurableProgressEvents::InvokeFinished