Пример #1
0
        public void PauseDoesNothingWhenNotRunning()
        {
            var tested = new TestedProgressReporter();

            Assert.False(tested.IsRunning);
            Assert.True(tested.IsIdle);
            tested.Pause();
            Assert.False(tested.IsRunning);
            Assert.True(tested.IsIdle);
        }
Пример #2
0
        public void UnpauseUnpauses()
        {
            var tested = new TestedProgressReporter();

            tested.Start(2);

            tested.ReportProgress();
            tested.Pause();

            tested.UnPause();
            var elapsed = tested.Elapsed;

            Thread.Sleep(1);
            Assert.True(tested.Elapsed > elapsed);
        }
Пример #3
0
        public void PausePauses()
        {
            var tested = new TestedProgressReporter();

            tested.Start(2);

            tested.ReportProgress();
            tested.Pause();

            var elapsed = tested.Elapsed;

            Thread.Sleep(1);

            Assert.Equal(elapsed, tested.Elapsed);
            Assert.False(tested.IsRunning);
            Assert.True(tested.IsIdle);
        }
Пример #4
0
        public void FinishTest()
        {
            const int numberOfIterations = 5;
            var       tested             = new TestedProgressReporter();

            Assert.False(tested.IsRunning);
            tested.Restart(numberOfIterations * 2);
            for (var i = 0; i < numberOfIterations; ++i)
            {
                Assert.True(tested.IsRunning);
                tested.ReportProgress();
            }
            Assert.False(tested.IsIdle);
            Assert.True(tested.IsRunning);
            tested.Pause();

            Assert.False(tested.IsRunning);
            Assert.True(tested.IsIdle);
        }