public void ProgressStepRunner_Observe()
        {
            // Setup
            ConfigurableProgressController controller = new ConfigurableProgressController();
            ConfigurableProgressControlHost host = new ConfigurableProgressControlHost();
            controller.AddSteps(new ConfigurableProgressStep());// Needs at least one

            // Act
            using (ProgressObserver observer1 = ProgressStepRunner.Observe(controller, host))
            {
                // Verify
                Assert.IsNotNull(observer1, "Unexpected return value");
                Assert.AreSame(observer1, ProgressStepRunner.ObservedControllers[controller]);
                host.AssertHasProgressControl();
            }
        }
Beispiel #2
0
        public void ProgressStepRunner_Observe()
        {
            // Arrange
            ConfigurableProgressController  controller = new ConfigurableProgressController();
            ConfigurableProgressControlHost host       = new ConfigurableProgressControlHost();

            controller.AddSteps(new ConfigurableProgressStep());// Needs at least one

            // Act
            using (ProgressObserver observer1 = ProgressStepRunner.Observe(controller, host))
            {
                // Assert
                observer1.Should().NotBeNull("Unexpected return value");
                ProgressStepRunner.ObservedControllers[controller].Should().Be(observer1);
                host.ProgressControl.Should().NotBeNull();
            }
        }
        public void ProgressStepRunner_Observe()
        {
            // Setup
            ConfigurableProgressController  controller = new ConfigurableProgressController();
            ConfigurableProgressControlHost host       = new ConfigurableProgressControlHost();

            controller.AddSteps(new ConfigurableProgressStep());// Needs at least one

            // Act
            using (ProgressObserver observer1 = ProgressStepRunner.Observe(controller, host))
            {
                // Verify
                Assert.IsNotNull(observer1, "Unexpected return value");
                Assert.AreSame(observer1, ProgressStepRunner.ObservedControllers[controller]);
                host.AssertHasProgressControl();
            }
        }
        public void ProgressStepRunner_AbortAll()
        {
            // Arrange
            ConfigurableProgressController controller1 = new ConfigurableProgressController();

            controller1.AddSteps(new ConfigurableProgressStep());// Needs at least one
            ConfigurableProgressControlHost host1      = new ConfigurableProgressControlHost();
            ProgressObserver observer1                 = ProgressStepRunner.Observe(controller1, host1);
            ConfigurableProgressController controller2 = new ConfigurableProgressController();

            controller2.AddSteps(new ConfigurableProgressStep());// Needs at least one
            ConfigurableProgressControlHost host2 = new ConfigurableProgressControlHost();
            ProgressObserver observer2            = ProgressStepRunner.Observe(controller2, host2);

            // Act
            ProgressStepRunner.AbortAll();

            // Assert
            controller1.NumberOfAbortRequests.Should().Be(1);
            controller2.NumberOfAbortRequests.Should().Be(1);
        }
        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();
            }
        }
Beispiel #6
0
        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();
            }
        }
        public void ProgressStepRunner_AbortAll()
        {
            // Setup
            ConfigurableProgressController controller1 = new ConfigurableProgressController();
            controller1.AddSteps(new ConfigurableProgressStep());// Needs at least one
            ConfigurableProgressControlHost host1 = new ConfigurableProgressControlHost();
            ProgressObserver observer1 = ProgressStepRunner.Observe(controller1, host1);
            ConfigurableProgressController controller2 = new ConfigurableProgressController();
            controller2.AddSteps(new ConfigurableProgressStep());// Needs at least one
            ConfigurableProgressControlHost host2 = new ConfigurableProgressControlHost();
            ProgressObserver observer2 = ProgressStepRunner.Observe(controller2, host2);

            // Act
            ProgressStepRunner.AbortAll();

            // Verify
            controller1.AssertNumberOfAbortRequests(1);
            controller2.AssertNumberOfAbortRequests(1);
        }