public void AssertStepOperationsCreatedForDefinitions(IProgressStepDefinition[] definitions, IProgressStepOperation[] stepOperations)
 {
     Assert.AreEqual(definitions.Length, stepOperations.Length, "The number of definitions doesn't match the number of step operations");
     for (int i = 0; i < definitions.Length; i++)
     {
         Assert.AreSame(stepOperations[i], this.CreatedOperations[definitions[i]], "Mismatch at definition {0}", i);
     }
 }
        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 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 void SequentialProgressController_IProgressStepFactory_SupportedInputs()
        {
            IProgressStepOperation stepOperation = this.testSubject.CreateStepOperation(this.controller, new ProgressStepDefinition("text", StepAttributes.None, (c, n) => { }));

            stepOperation.Should().NotBeNull("Expecting IProgressStepOperation");
            ProgressControllerStep step = stepOperation as ProgressControllerStep;

            step.Should().NotBeNull("Expecting ProgressControllerStep");

            VerificationHelper.CheckState(stepOperation.Step, StepExecutionState.NotStarted);

            IProgressStepExecutionEvents notifier = ((IProgressStepFactory)this.testSubject).GetExecutionCallback(stepOperation);

            stepOperation.Should().NotBeNull("Expecting IProgressStepExecutionEvents");
            notifier.Should().Be(step, "Expecting ProgressControllerStep");
        }
Beispiel #5
0
        /// <summary>
        /// Executes the operation and waits for completion
        /// </summary>
        /// <param name="stepOperation">The operation to execute</param>
        public void Execute(IProgressStepOperation stepOperation)
        {
            this.stepOperations.Clear();
            // Insert a delegate that will be executed after the controller has started and before the actual step operation
            if (this.ExecuteAfterStarted != null)
            {
                this.stepOperations.Add(new ConfigurableProgressTestOperation((c, n) => this.ExecuteAfterStarted(this)));
            }

            this.stepOperations.Add(stepOperation);

            using (ManualResetEventSlim signal = new ManualResetEventSlim())
            {
                ((IProgressController)this).StartAsync().ContinueWith(t => signal.Set());

                signal.Wait(this.waitForCompletion);
            }
        }
        /// <summary>
        /// Executes the operation and waits for completion
        /// </summary>
        /// <param name="stepOperation">The operation to execute</param>
        public void Execute(IProgressStepOperation stepOperation)
        {
            this.stepOperations.Clear();
            // Insert a delegate that will be executed after the controller has started and before the actual step operation
            if (this.ExecuteAfterStarted != null)
            {
                this.stepOperations.Add(new ConfigurableProgressTestOperation((c, n) => this.ExecuteAfterStarted(this)));
            }

            this.stepOperations.Add(stepOperation);

            using (ManualResetEventSlim signal = new ManualResetEventSlim())
            {
                ((IProgressController)this).Start().ContinueWith(t => signal.Set());

                signal.Wait(this.waitForCompletion);
            }
        }
 IProgressStepExecutionEvents IProgressStepFactory.GetExecutionCallback(IProgressStepOperation stepOperation)
 {
     return(this.CreatedNotifiers[stepOperation] = new ConfigurableProgressStepExecutionNotifier());
 }
 IProgressStepExecutionEvents IProgressStepFactory.GetExecutionCallback(IProgressStepOperation stepOperation)
 {
     return this.CreatedNotifiers[stepOperation] = new ConfigurableProgressStepExecutionNotifier();
 }