Partial class implementation of IProgressStepExecutionEvents
Inheritance: IProgressStepExecutionEvents
        /// <summary>
        /// Verifies that the <see cref="ProgressControllerStep"/> was initialized correctly
        /// </summary>
        /// <param name="testSubject">The step to verify</param>
        /// <param name="attributes">Step attributes</param>
        /// <param name="displayText">Step display text</param>
        public static void VerifyInitialized(ProgressControllerStep testSubject, StepAttributes attributes, string displayText = null)
        {
            StepExecution expectedExecution = (attributes & StepAttributes.BackgroundThread) != 0 ? StepExecution.BackgroundThread : StepExecution.ForegroundThread;
            bool expectedHidden = (attributes & StepAttributes.Hidden) != 0 ? true : false;
            bool expectedCancellable = (attributes & StepAttributes.NonCancellable) != 0 ? false : true;
            bool expectedImpactingProgress = (attributes & StepAttributes.NoProgressImpact) != 0 ? false : true;
            bool expectedIndeterminate = (attributes & StepAttributes.Indeterminate) != 0 ? true : false;

            CheckState(testSubject, StepExecutionState.NotStarted);
            Assert.AreEqual(displayText, testSubject.DisplayText, "Unexpected display text");
            Assert.AreEqual(expectedCancellable, testSubject.Cancellable, "Cancellable: Unexpected post initialization value");
            Assert.AreEqual(expectedIndeterminate, testSubject.Indeterminate, "Indeterminate: Unexpected post initialization value");
            Assert.AreEqual(expectedExecution, testSubject.Execution, "Execution: Unexpected post initialization value");
            Assert.AreEqual(expectedHidden, testSubject.Hidden, "Hidden: Unexpected post initialization value");
            Assert.AreEqual(expectedImpactingProgress, testSubject.ImpactsProgress, "ImpactingProgress: Unexpected post initialization value");

            if (expectedIndeterminate)
            {
                Assert.IsTrue(ProgressControllerHelper.IsIndeterminate(testSubject.Progress), "Progess: Should be Indeterminate");
            }
            else
            {
                Assert.AreEqual(0, testSubject.Progress, "Progress: Unexpected post initialization value");
            }
        }
        public IProgressStepExecutionEvents GetExecutionCallback(IProgressStepOperation stepOperation)
        {
            ProgressControllerStep supportedStep = stepOperation as ProgressControllerStep;

            if (supportedStep == null)
            {
                throw new InvalidOperationException(string.Format(CultureInfo.CurrentCulture, ProgressResources.UnsupportedTypeException, stepOperation.GetType().FullName, typeof(ProgressControllerStep).FullName));
            }

            return(supportedStep);
        }
        public IProgressStepOperation CreateStepOperation(IProgressController controller, IProgressStepDefinition definition)
        {
            if (controller == null)
            {
                throw new ArgumentNullException(nameof(controller));
            }

            ProgressStepDefinition supportedDefinition = definition as ProgressStepDefinition;
            if (supportedDefinition == null)
            {
                throw new InvalidOperationException(string.Format(CultureInfo.CurrentCulture, ProgressResources.UnsupportedTypeException, definition.GetType().FullName, typeof(ProgressStepDefinition).FullName));
            }

            ProgressControllerStep step = new ProgressControllerStep(controller, supportedDefinition);
            return step;
        }
        public IProgressStepOperation CreateStepOperation(IProgressController controller, IProgressStepDefinition definition)
        {
            if (controller == null)
            {
                throw new ArgumentNullException(nameof(controller));
            }

            ProgressStepDefinition supportedDefinition = definition as ProgressStepDefinition;

            if (supportedDefinition == null)
            {
                throw new InvalidOperationException(string.Format(CultureInfo.CurrentCulture, ProgressResources.UnsupportedTypeException, definition.GetType().FullName, typeof(ProgressStepDefinition).FullName));
            }

            ProgressControllerStep step = new ProgressControllerStep(controller, supportedDefinition);

            return(step);
        }
        private void InitializeAndExecuteTestSubject(string text, StepAttributes attributes, Action<CancellationToken, IProgressStepExecutionEvents> operation)
        {
            // Setup
            this.testSubject = new ProgressControllerStep(this.testController, new ProgressStepDefinition(text, attributes, operation));

            // Verify initialized state
            VerificationHelper.VerifyInitialized(this.testSubject, attributes, text);

            // Execute by the controller
            this.testController.Execute(this.testSubject);
        }