示例#1
0
 //Вершок
 private void textBox5_TextChanged(object sender, EventArgs e)
 {
     if (!activeTextBox)
     {
         if (textBox5.Text != "")
         {
             try
             {
                 activeTextBox = true;
                 double  lenght  = Convert.ToDouble(textBox5.Text);
                 Vershok vershok = new Vershok();
                 textBox1.Text  = Convert.ToString(vershok.getMetr(lenght));
                 textBox2.Text  = Convert.ToString(vershok.getSm(lenght));
                 textBox3.Text  = Convert.ToString(vershok.getDm(lenght));
                 textBox4.Text  = Convert.ToString(vershok.getMm(lenght));
                 textBox6.Text  = Convert.ToString(vershok.getPyad(lenght));
                 textBox7.Text  = Convert.ToString(vershok.getArshin(lenght));
                 textBox8.Text  = Convert.ToString(vershok.getSAgen(lenght));
                 textBox9.Text  = Convert.ToString(vershok.getFoot(lenght));
                 textBox10.Text = Convert.ToString(vershok.getInch(lenght));
                 textBox11.Text = Convert.ToString(vershok.getCable(lenght));
                 textBox12.Text = Convert.ToString(vershok.getYard(lenght));
             }
             catch (Exception)
             {
                 MessageBox.Show("Ошибка в вводимого значения");
                 textBox5.Clear();
             }
             activeTextBox = false;
         }
     }
 }
示例#2
0
        public void TestVershok()
        {
            Vershok vershok = new Vershok();
            double  result  = vershok.getMetr(10);

            Assert.AreEqual(result, 0.445, 0.001, "Ошибка конвертации");
            result = vershok.getDm(10);
            Assert.AreEqual(result, 4.45, 0.001, "Ошибка конвертации");
            result = vershok.getSm(10);
            Assert.AreEqual(result, 44.45, 0.001, "Ошибка конвертации");
            result = vershok.getMm(10);
            Assert.AreEqual(result, 444.5, 0.001, "Ошибка конвертации");
            result = vershok.getPyad(10);
            Assert.AreEqual(result, 2.5, 0.001, "Ошибка конвертации");
            result = vershok.getArshin(10);
            Assert.AreEqual(result, 0.625, 0.001, "Ошибка конвертации");
            result = vershok.getSAgen(10);
            Assert.AreEqual(result, 0.208, 0.001, "Ошибка конвертации");
        }