Esempio n. 1
0
		public void TestZeroMaximum()
		{
			var progress = new MockProgressBarForm();
			progress.Show();
			Application.DoEvents();

			progress.SetMaximum(0);
			progress.IncrementValue(1);

			Assert.AreEqual(progress.Maximum, progress.Value, "The progress value was not as expected.");

			progress.Close();
			Application.DoEvents();
		}
Esempio n. 2
0
		public void TestNormalIncrement()
		{
			var progress = new MockProgressBarForm();
			progress.Show();
			Application.DoEvents();

			const int max = 100;
			const int inc = 10;
			const int steps = max / inc;

			progress.SetMaximum(max);
			for (int i = 0; i < steps; i++)
			{
				progress.IncrementValue(inc);
			}

			Assert.AreEqual(progress.Maximum, progress.Value, "The progress value was not as expected.");

			progress.Close();
			Application.DoEvents();
		}
Esempio n. 3
0
		public void TestHugeMaximum()
		{
			var progress = new MockProgressBarForm();
			progress.Show();
			Application.DoEvents();

			const long max = Int64.MaxValue;
			const long steps = 10;
			const long inc = max / steps;
			const long lastInc = max % steps;

			progress.SetMaximum(max);
			for (int i = 0; i < steps; i++)
			{
				progress.IncrementValue(inc);
			}
			progress.IncrementValue(lastInc);

			Assert.AreEqual(progress.Maximum, progress.Value, "The progress value was not as expected.");

			progress.Close();
			Application.DoEvents();
		}
Esempio n. 4
0
		public void TestReset()
		{
			var progress = new MockProgressBarForm();
			progress.Show();
			Application.DoEvents();

			progress.SetMaximum(2);
			progress.IncrementValue(1);
			progress.ResetValue();

			Assert.AreEqual(0, progress.Value, "The progress value was not as expected.");
			Assert.AreEqual(2, progress.Maximum, "The progress maximum was unexpectedly changed.");

			progress.Close();
			Application.DoEvents();
		}