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

AssertAllEventsAreUnregistered() public method

public AssertAllEventsAreUnregistered ( ) : void
return void
        public void AssertAllEventsAreUnregistered()
        {
            Assert.IsNull(this.Started, "The Started event is registered");
            Assert.IsNull(this.Finished, "The Finished event is registered");
            Assert.IsNull(this.StepExecutionChanged, "The StepExecutionChanged event is registered");
            Assert.IsNull(this.CancellationSupportChanged, "The CancellationSupportChanged event is registered");
        }
        #endregion

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::AssertAllEventsAreUnregistered