/// <summary> /// Кнопка для создания рандомных значений /// и добавления их в datagrid /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void RandomButton_Click(object sender, EventArgs e) { var Rundom = new Random(); for (int i = 0; i < 10; i++) { IMotion iMotion = null; const double chislo = 100; switch (Rundom.Next() % 3) { case 0: { iMotion = new AcceleratedMotion(Rundom.NextDouble() * chislo, Rundom.NextDouble() * chislo, Convert.ToInt32(Rundom.Next(0, 20) * chislo), Rundom.NextDouble() * chislo); break; } case 1: { iMotion = new OscillatoryMotion(Rundom.NextDouble() * chislo, Rundom.NextDouble() * chislo, Convert.ToInt32(Rundom.Next(0, 20) * chislo), Rundom.NextDouble() * chislo, Rundom.NextDouble() * chislo); break; } case 2: { iMotion = new UniformlyAcceleratedMotion(Rundom.NextDouble() * chislo, Rundom.NextDouble() * chislo, Convert.ToInt32(Rundom.Next(0, 20) * chislo)); break; } } AddMotion(iMotion); } }
public void CalculateCoordination(double counAx, double countVx, double countX0, int countTime) { var calulator = new AcceleratedMotion(countX0, counAx, countTime, countVx); var result = calulator.CalculateCoordination(); Assert.AreEqual(166, result); }
public void XATest(double count) { var acceleratedMotion = new AcceleratedMotion { AX = count }; }
public void TimeTest(uint count) { var acceleratedMotion = new AcceleratedMotion { Time = count }; }
public void TimeTest(int count) { var acceleratedMotion = new AcceleratedMotion(); Assert.Throws <MinusExeption>(() => acceleratedMotion.Time = count); }
public void Vx(double count) { var acceleratedMotion = new AcceleratedMotion(); Assert.Throws <MinusExeption>(() => acceleratedMotion.V0X = count); }