Exemplo n.º 1
0
        public void TestMethod1()
        {
            MyPoint a = new MyPoint(0, 0);
            MyPoint b = new MyPoint(0, 3);
            MyPoint c = new MyPoint(4, 3);
            MyPoint d = new MyPoint(4, 0);

            MyPoint e = new MyPoint(2, 2);

            myParallelogram parall = new myParallelogram(a, b, c, d);

            Assert.AreEqual(true, parall.isCorrect(), "correct data chelking");
            parall = new myParallelogram(a, b, e, d);
            Assert.AreEqual(false, parall.isCorrect(), "incorrect data chelking");
        }
Exemplo n.º 2
0
 private void button_check_Click(object sender, EventArgs e)
 {
     List<MyPoint> points = new List<MyPoint>();
     string query = textBox_addtr.Text;
     foreach (string xy in query.Split(';'))
     {
         int x = Convert.ToInt32(xy.Split(',')[0]);
         int y = Convert.ToInt32(xy.Split(',')[1]);
         points.Add(new MyPoint(x, y));
     }
     myParallelogram par = new myParallelogram(points[0], points[1], points[2], points[3]);
     if (par.isCorrect())
     {
         MessageBox.Show("Параллелограмм");
     }
     else
     {
         MessageBox.Show("Не является параллелограммом");
     }
 }