UpButton() public méthode

Handles the clicking of the up button on the spin box.
public UpButton ( ) : void
Résultat void
		public void UpDownButtons_IncrementFactor()
		{
			using (UpDownMeasureControl c = new UpDownMeasureControl())
			{
				c.MeasureType = MsrSysType.Point;
				c.MeasureMin = -10000;
				c.MeasureMax = 10000;
				c.MeasureValue = 2000;
				c.MeasureIncrementFactor = 6;
				c.UpButton();
				Assert.AreEqual(6000, c.MeasureValue);
				Assert.AreEqual("6 pt", c.Text);
				c.UpButton();
				Assert.AreEqual(10000, c.MeasureValue);
				Assert.AreEqual("10 pt", c.Text);
				c.DownButton();
				Assert.AreEqual(6000, c.MeasureValue);
				Assert.AreEqual("6 pt", c.Text);
				c.DownButton();
				Assert.AreEqual(0, c.MeasureValue);
				Assert.AreEqual("0 pt", c.Text);
				c.DownButton();
				Assert.AreEqual(-6000, c.MeasureValue);
				Assert.AreEqual("-6 pt", c.Text);
				c.DownButton();
				Assert.AreEqual(-10000, c.MeasureValue);
				Assert.AreEqual("-10 pt", c.Text);
			}
		}
		public void UpButton()
		{
			using (UpDownMeasureControl c = new UpDownMeasureControl())
			{
				c.MeasureType = MsrSysType.Point;
				c.MeasureMin = -100000;
				c.MeasureMax = 100000;
				c.MeasureValue = 2000;
				c.UpButton();
				Assert.AreEqual(3000, c.MeasureValue);
				Assert.AreEqual("3 pt", c.Text);
				c.MeasureValue = 2456;
				c.UpButton();
				Assert.AreEqual(3000, c.MeasureValue);
				Assert.AreEqual("3 pt", c.Text);
				c.MeasureValue = 100000;
				c.UpButton();
				Assert.AreEqual(100000, c.MeasureValue);
				Assert.AreEqual("100 pt", c.Text);
				c.MeasureValue = -3200;
				c.UpButton();
				Assert.AreEqual(-3000, c.MeasureValue);
				Assert.AreEqual("-3 pt", c.Text);

				c.MeasureType = MsrSysType.Cm;
				c.Text = "2.8";
				c.UpButton();
				Assert.AreEqual(82205, c.MeasureValue);
				Assert.AreEqual("2.9 cm", c.Text);
				c.Text = "2.85";
				c.UpButton();
				Assert.AreEqual(82205, c.MeasureValue);
				Assert.AreEqual("2.9 cm", c.Text);
				c.Text = "3.5";
				c.UpButton();
				Assert.AreEqual(100000, c.MeasureValue);
				Assert.AreEqual("3.53 cm", c.Text);
				c.Text = "-2";
				c.UpButton();
				Assert.AreEqual(-53858, c.MeasureValue);
				Assert.AreEqual("-1.9 cm", c.Text);

				c.MeasureType = MsrSysType.Inch;
				c.Text = "1";
				c.UpButton();
				Assert.AreEqual(79200, c.MeasureValue);
				Assert.AreEqual("1.1\"", c.Text);
				c.Text = "1.009";
				c.UpButton();
				Assert.AreEqual(79200, c.MeasureValue);
				Assert.AreEqual("1.1\"", c.Text);
				c.Text = "1.3";
				c.UpButton();
				Assert.AreEqual(100000, c.MeasureValue);
				Assert.AreEqual("1.39\"", c.Text);
				c.Text = "-0.95";
				c.UpButton();
				Assert.AreEqual(-64800, c.MeasureValue);
				Assert.AreEqual("-0.9\"", c.Text);

				c.MeasureType = MsrSysType.Mm;
				c.Text = "2";
				c.UpButton();
				Assert.AreEqual(8504, c.MeasureValue);
				Assert.AreEqual("3 mm", c.Text);
				c.Text = "2.72";
				c.UpButton();
				Assert.AreEqual(8504, c.MeasureValue);
				Assert.AreEqual("3 mm", c.Text);
				c.Text = "35";
				c.UpButton();
				Assert.AreEqual(100000, c.MeasureValue);
				Assert.AreEqual("35.28 mm", c.Text);
				c.Text = "0";
				c.UpButton();
				Assert.AreEqual(2835, c.MeasureValue);
				Assert.AreEqual("1 mm", c.Text);
			}
		}