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 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 void SequentialProgressController_IProgressController_Initialize() { // Arrange ConfigurableProgressStepFactory testFactory = new ConfigurableProgressStepFactory(); IProgressStepDefinition[] definitions = new IProgressStepDefinition[] { new StubProgressStepDefinition(), new StubProgressStepDefinition(), new StubProgressStepDefinition() }; // Act this.testSubject.Initialize(testFactory, definitions); // Assert IProgressStepOperation[] stepOperations = this.testSubject.Steps.OfType <IProgressStepOperation>().ToArray(); testFactory.AssertStepOperationsCreatedForDefinitions(definitions, stepOperations); }
IProgressStepOperation IProgressStepFactory.CreateStepOperation(IProgressController controller, IProgressStepDefinition definition) { return(this.CreatedOperations[definition] = this.CreateOpeartion(definition)); }
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); }
IProgressStepOperation IProgressStepFactory.CreateStepOperation(IProgressController controller, IProgressStepDefinition definition) { return this.CreatedOperations[definition] = this.CreateOpeartion(definition); }
public void SequentialProgressController_IProgressController_Initialize() { // Setup ConfigurableProgressStepFactory testFactory = new ConfigurableProgressStepFactory(); IProgressStepDefinition[] definitions = new IProgressStepDefinition[] { new StubProgressStepDefinition(), new StubProgressStepDefinition(), new StubProgressStepDefinition() }; // Execute this.testSubject.Initialize(testFactory, definitions); // Verify IProgressStepOperation[] stepOperations = this.testSubject.Steps.OfType<IProgressStepOperation>().ToArray(); testFactory.AssertStepOperationsCreatedForDefinitions(definitions, stepOperations); }