public void TestInitialize() { ConfigurableServiceProvider sp = new ConfigurableServiceProvider(); sp.RegisterService(typeof(SVsTaskSchedulerService), new SingleThreadedTaskSchedulerService()); this.testController = new ConfigurableProgressController(sp); }
public void TestInitialize() { this.testServiceProvider = new ConfigurableServiceProvider(); this.testVisualizer = new ConfigurableProgressVisualizer(); this.progressEvents = new ConfigurableProgressEvents(); this.testController = new ConfigurableProgressController(this.testServiceProvider); this.testController.Events = this.progressEvents; this.threadService = new SingleThreadedTaskSchedulerService(); this.testServiceProvider.RegisterService(typeof(SVsTaskSchedulerService), this.threadService); }
public void TestInitialize() { this.testServiceProvider = new ConfigurableServiceProvider(); this.testVisualizer = new ConfigurableProgressVisualizer(); this.progressEvents = new ConfigurableProgressEvents(); this.testController = new ConfigurableProgressController(this.testServiceProvider); this.testController.Events = this.progressEvents; this.threadService = new SingleThreadedTaskSchedulerService(); this.testServiceProvider.RegisterService(typeof(SVsTaskSchedulerService), this.threadService); }
public void TestCleanup() { if (this.testSubject != null) { ((IDisposable)this.testSubject).Dispose(); this.testSubject = null; } this.testVisualizer = null; this.testServiceProvider = null; this.progressEvents = null; this.threadService = null; this.testController = null; }
public void TestCleanup() { if (this.testSubject != null) { ((IDisposable)this.testSubject).Dispose(); this.testSubject = null; } this.testVisualizer = null; this.testServiceProvider = null; this.progressEvents = null; this.threadService = null; this.testController = null; }
public void DeterminateStepProgressNotifier_NotifyCurrentProgress() { // Setup var controller = new ConfigurableProgressController(null); const int Steps = 2; var testSubject = new DeterminateStepProgressNotifier(controller, Steps); List<Tuple<string, double>> expectedProgress = new List<Tuple<string, double>>(); // Act + Verify for (int i = 0; i < Steps; i++) { expectedProgress.Add(Tuple.Create("hello world " + i, 0.0)); testSubject.NotifyCurrentProgress(expectedProgress.Last().Item1); Assert.AreEqual(0, testSubject.CurrentValue, "Should not change"); controller.AssertProgressChangeEvents(expectedProgress); } }
public void DeterminateStepProgressNotifier_NotifyCurrentProgress() { // Arrange var controller = new ConfigurableProgressController(null); const int Steps = 2; var testSubject = new DeterminateStepProgressNotifier(controller, Steps); List <Tuple <string, double> > expectedProgress = new List <Tuple <string, double> >(); // Act + Assert for (int i = 0; i < Steps; i++) { expectedProgress.Add(Tuple.Create("hello world " + i, 0.0)); testSubject.NotifyCurrentProgress(expectedProgress.Last().Item1); testSubject.CurrentValue.Should().Be(0, "Should not change"); controller.progressChanges.Should().Equal(expectedProgress); } }
public void DeterminateStepProgressNotifier_IncrementProgress() { // Setup var controller = new ConfigurableProgressController(null); const int Steps = 227; // Quite a few values for which N * (1 / N) > 1.0 var testSubject = new DeterminateStepProgressNotifier(controller, Steps); List<Tuple<string, double>> expectedProgress = new List<Tuple<string, double>>(); // Act + Verify int expectedValue = 0; int i = 0; while(expectedValue < Steps) { int increment = i % 2 == 0 ? 2 : 1; i++; expectedValue += increment; testSubject.IncrementProgress(increment); Assert.AreEqual(expectedValue, testSubject.CurrentValue); } }
public void DeterminateStepProgressNotifier_IncrementProgress() { // Arrange var controller = new ConfigurableProgressController(null); const int Steps = 227; // Quite a few values for which N * (1 / N) > 1.0 var testSubject = new DeterminateStepProgressNotifier(controller, Steps); List <Tuple <string, double> > expectedProgress = new List <Tuple <string, double> >(); // Act + Assert int expectedValue = 0; int i = 0; while (expectedValue < Steps) { int increment = i % 2 == 0 ? 2 : 1; i++; expectedValue += increment; testSubject.IncrementProgress(increment); testSubject.CurrentValue.Should().Be(expectedValue); } }
public void DeterminateStepProgressNotifier_NotifyIncrementedProgress() { // Arrange var controller = new ConfigurableProgressController(null); const int Steps = 11; // there are two numbers (9 and 11) for which N * (1 / N) > 1.0 var testSubject = new DeterminateStepProgressNotifier(controller, Steps); List <Tuple <string, double> > expectedProgress = new List <Tuple <string, double> >(); // Act + Assert for (int i = 0; i < Steps; i++) { int incrementedStepValue = i + 1; double progress = incrementedStepValue == Steps ? 1.0 : (double)incrementedStepValue / Steps; expectedProgress.Add(Tuple.Create("hello world " + i, progress)); testSubject.CurrentValue.Should().Be(i); testSubject.NotifyIncrementedProgress(expectedProgress.Last().Item1); testSubject.CurrentValue.Should().Be(incrementedStepValue); controller.progressChanges.Should().Equal(expectedProgress); } }
public void TestCleanup() { this.testSubject = null; this.controller = null; }
public void TestInitialize() { this.testSubject = new DefaultProgressStepFactory(); this.controller = new ConfigurableProgressController(new ConfigurableServiceProvider()); }
public void TestInitialize() { ConfigurableServiceProvider sp = new ConfigurableServiceProvider(); sp.RegisterService(typeof(SVsTaskSchedulerService), new SingleThreadedTaskSchedulerService()); this.testController = new ConfigurableProgressController(sp); }
public void DeterminateStepProgressNotifier_NotifyIncrementedProgress() { // Setup var controller = new ConfigurableProgressController(null); const int Steps = 11; // there are two numbers (9 and 11) for which N * (1 / N) > 1.0 var testSubject = new DeterminateStepProgressNotifier(controller, Steps); List<Tuple<string, double>> expectedProgress = new List<Tuple<string, double>>(); // Act + Verify for (int i = 0; i < Steps; i++) { int incrementedStepValue = i + 1; double progress = incrementedStepValue == Steps ? 1.0 : (double)incrementedStepValue / Steps; expectedProgress.Add(Tuple.Create("hello world " + i, progress)); Assert.AreEqual(i, testSubject.CurrentValue); testSubject.NotifyIncrementedProgress(expectedProgress.Last().Item1); Assert.AreEqual(incrementedStepValue, testSubject.CurrentValue); controller.AssertProgressChangeEvents(expectedProgress); } }
public void TestCleanup() { this.testSubject = null; this.controller = null; }
public void TestInitialize() { this.testSubject = new DefaultProgressStepFactory(); this.controller = new ConfigurableProgressController(new ConfigurableServiceProvider()); }