//Пядь private void textBox6_TextChanged(object sender, EventArgs e) { if (!activeTextBox) { if (textBox6.Text != "") { try { activeTextBox = true; double lenght = Convert.ToDouble(textBox6.Text); Pyad pyad = new Pyad(); textBox1.Text = Convert.ToString(pyad.getMetr(lenght)); textBox2.Text = Convert.ToString(pyad.getSm(lenght)); textBox3.Text = Convert.ToString(pyad.getDm(lenght)); textBox4.Text = Convert.ToString(pyad.getMm(lenght)); textBox5.Text = Convert.ToString(pyad.getVershok(lenght)); textBox7.Text = Convert.ToString(pyad.getArshin(lenght)); textBox8.Text = Convert.ToString(pyad.getSagen(lenght)); textBox9.Text = Convert.ToString(pyad.getFoot(lenght)); textBox10.Text = Convert.ToString(pyad.getInch(lenght)); textBox11.Text = Convert.ToString(pyad.getCable(lenght)); textBox12.Text = Convert.ToString(pyad.getYard(lenght)); } catch (Exception) { MessageBox.Show("Ошибка в вводимого значения"); textBox6.Clear(); } activeTextBox = false; } } }
public void TestPyad() { Pyad pyad = new Pyad(); double result = pyad.getMetr(13); Assert.AreEqual(result, 2.314, 0.001, "Ошибка конвертации"); result = pyad.getDm(13); Assert.AreEqual(result, 23.114, 0.001, "Ошибка конвертации"); result = pyad.getSm(13); Assert.AreEqual(result, 231.14, 0.001, "Ошибка конвертации"); result = pyad.getMm(13); Assert.AreEqual(result, 2311.4, 0.001, "Ошибка конвертации"); result = pyad.getVershok(13); Assert.AreEqual(result, 52, 0.001, "Ошибка конвертации"); result = pyad.getArshin(13); Assert.AreEqual(result, 3.25, 0.001, "Ошибка конвертации"); result = pyad.getSagen(13); Assert.AreEqual(result, 1.0829, 0.001, "Ошибка конвертации"); }