AssertProgressChangeEvents() публичный Метод

public AssertProgressChangeEvents ( double>.List expectedOrderedProgressEvents ) : void
expectedOrderedProgressEvents double>.List
Результат void
        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);
            }
        }
Пример #2
0
        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);
            }
        }
Пример #3
0
        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 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);
            }
        }