public void ProgressStepRunner_ChangeHost() { // Arrange ConfigurableProgressController controller = new ConfigurableProgressController(); controller.AddSteps(new ConfigurableProgressStep());// Needs at least one ConfigurableProgressControlHost host1 = new ConfigurableProgressControlHost(); ProgressObserver observer = ProgressStepRunner.Observe(controller, host1); // Act ConfigurableProgressControlHost host2 = new ConfigurableProgressControlHost(); ProgressStepRunner.ChangeHost(host2); // Assert using (var newObserver = ProgressStepRunner.ObservedControllers[controller]) { newObserver.Should().NotBeNull(); observer.Should().NotBe(newObserver); newObserver.State.Should().Be(observer.State, "State was not transferred"); host2.ProgressControl.Should().NotBeNull(); } }
public void ProgressStepRunner_ChangeHost() { // Setup ConfigurableProgressController controller = new ConfigurableProgressController(); controller.AddSteps(new ConfigurableProgressStep());// Needs at least one ConfigurableProgressControlHost host1 = new ConfigurableProgressControlHost(); ProgressObserver observer = ProgressStepRunner.Observe(controller, host1); // Act ConfigurableProgressControlHost host2 = new ConfigurableProgressControlHost(); ProgressStepRunner.ChangeHost(host2); // Verify using (var newObserver = ProgressStepRunner.ObservedControllers[controller]) { Assert.IsNotNull(newObserver); Assert.AreNotSame(newObserver, observer); Assert.AreSame(observer.State, newObserver.State, "State was not transferred"); host2.AssertHasProgressControl(); } }
void IProgressStepRunnerWrapper.ChangeHost(IProgressControlHost host) { ProgressStepRunner.ChangeHost(host); }