public void TestCable() { Cable cable = new Cable(); double result = cable.getMetr(7); Assert.AreEqual(result, 1296.4, 0.001, "Ошибка конвертации"); result = cable.getDm(7); Assert.AreEqual(result, 12964, 0.001, "Ошибка конвертации"); result = cable.getSm(7); Assert.AreEqual(result, 129640, 0.001, "Ошибка конвертации"); result = cable.getMm(7); Assert.AreEqual(result, 1296400, 0.001, "Ошибка конвертации"); result = cable.getVershok(7); Assert.AreEqual(result, 29162, 0.001, "Ошибка конвертации"); result = cable.getPyad(7); Assert.AreEqual(result, 7294, 0.001, "Ошибка конвертации"); result = cable.getArshin(7); Assert.AreEqual(result, 1822.8, 0.001, "Ошибка конвертации"); result = cable.getSagen(7); Assert.AreEqual(result, 607.6, 0.001, "Ошибка конвертации"); result = cable.getInch(7); Assert.AreEqual(result, 51037, 0.001, "Ошибка конвертации"); result = cable.getFoot(7); Assert.AreEqual(result, 4253.2, 0.001, "Ошибка конвертации"); result = cable.getYard(7); Assert.AreEqual(result, 1417.5, 0.001, "Ошибка конвертации"); }
private void textBox11_TextChanged(object sender, EventArgs e) { if (!activeTextBox) { if (textBox11.Text != "") { try { activeTextBox = true; double lenght = Convert.ToDouble(textBox11.Text); Cable cable = new Cable(); textBox1.Text = Convert.ToString(cable.getMetr(lenght)); textBox2.Text = Convert.ToString(cable.getSm(lenght)); textBox3.Text = Convert.ToString(cable.getDm(lenght)); textBox4.Text = Convert.ToString(cable.getMm(lenght)); textBox5.Text = Convert.ToString(cable.getVershok(lenght)); textBox6.Text = Convert.ToString(cable.getPyad(lenght)); textBox7.Text = Convert.ToString(cable.getArshin(lenght)); textBox8.Text = Convert.ToString(cable.getSagen(lenght)); textBox9.Text = Convert.ToString(cable.getFoot(lenght)); textBox10.Text = Convert.ToString(cable.getInch(lenght)); textBox12.Text = Convert.ToString(cable.getYard(lenght)); } catch (Exception) { MessageBox.Show("Ошибка в вводимого значения"); textBox11.Clear(); } activeTextBox = false; } } }