示例#1
0
        public void TestYard()
        {
            Yard   yard   = new Yard();
            double result = yard.getMetr(7);

            Assert.AreEqual(result, 6.398, 0.001, "Ошибка конвертации");
            result = yard.getDm(7);
            Assert.AreEqual(result, 64.008, 0.001, "Ошибка конвертации");
            result = yard.getSm(7);
            Assert.AreEqual(result, 640.08, 0.001, "Ошибка конвертации");
            result = yard.getMm(7);
            Assert.AreEqual(result, 6400.8, 0.001, "Ошибка конвертации");
            result = yard.getVershok(7);
            Assert.AreEqual(result, 143.99, 0.001, "Ошибка конвертации");
            result = yard.getPyad(7);
            Assert.AreEqual(result, 36, 0.001, "Ошибка конвертации");
            result = yard.getArshin(7);
            Assert.AreEqual(result, 9.002, 0.001, "Ошибка конвертации");
            result = yard.getSagen(7);
            Assert.AreEqual(result, 3.003, 0.001, "Ошибка конвертации");
            result = yard.getInch(7);
            Assert.AreEqual(result, 252, 0.001, "Ошибка конвертации");
            result = yard.getFoot(7);
            Assert.AreEqual(result, 21, 0.001, "Ошибка конвертации");
            result = yard.getCable(7);
            Assert.AreEqual(result, 0.03458, 0.001, "Ошибка конвертации");
        }
示例#2
0
 private void textBox12_TextChanged(object sender, EventArgs e)
 {
     if (!activeTextBox)
     {
         if (textBox12.Text != "")
         {
             try
             {
                 activeTextBox = true;
                 double lenght = Convert.ToDouble(textBox12.Text);
                 Yard   yard   = new Yard();
                 textBox1.Text  = Convert.ToString(yard.getMetr(lenght));
                 textBox2.Text  = Convert.ToString(yard.getSm(lenght));
                 textBox3.Text  = Convert.ToString(yard.getDm(lenght));
                 textBox4.Text  = Convert.ToString(yard.getMm(lenght));
                 textBox5.Text  = Convert.ToString(yard.getVershok(lenght));
                 textBox6.Text  = Convert.ToString(yard.getPyad(lenght));
                 textBox7.Text  = Convert.ToString(yard.getArshin(lenght));
                 textBox8.Text  = Convert.ToString(yard.getSagen(lenght));
                 textBox9.Text  = Convert.ToString(yard.getFoot(lenght));
                 textBox10.Text = Convert.ToString(yard.getInch(lenght));
                 textBox11.Text = Convert.ToString(yard.getCable(lenght));
             }
             catch (Exception)
             {
                 MessageBox.Show("Ошибка в вводимого значения");
                 textBox12.Clear();
             }
             activeTextBox = false;
         }
     }
 }