public void NonIntergerError_TriangleTest()
        {
            TriangleModel tm       = new TriangleModel("Test", "0", "0");
            TriangleType  testtype = tm.GetTriangleType(tm);

            Assert.AreEqual(TriangleType.Error.ToString(), testtype.ToString());
        }
        public void NegativeError_TriangleTest()
        {
            TriangleModel tm       = new TriangleModel("-40", "10", "30");
            TriangleType  testtype = tm.GetTriangleType(tm);

            Assert.AreEqual(TriangleType.Error.ToString(), testtype.ToString());
        }
        public void Scalene_TriangleTest()
        {
            TriangleModel tm       = new TriangleModel("40", "10", "30");
            TriangleType  testtype = tm.GetTriangleType(tm);

            Assert.AreEqual(TriangleType.Scalene.ToString(), testtype.ToString());
        }
        public void Isosceles_TriangleTest()
        {
            TriangleModel tm       = new TriangleModel("30", "30", "40");
            TriangleType  testtype = tm.GetTriangleType(tm);

            Assert.AreEqual(TriangleType.Isosceles.ToString(), testtype.ToString());
        }
        public void Equilateral_TriangleTest()
        {
            TriangleModel tm       = new TriangleModel("30", "30", "30");
            TriangleType  testtype = tm.GetTriangleType(tm);

            Assert.AreEqual(TriangleType.Equilateral.ToString(), testtype.ToString());
        }
Пример #6
0
 private void btnResult_Click(object sender, EventArgs e)
 {
     if (ValidateForm())
     {
         TriangleModel model = new TriangleModel(txtnumber1.Text, txtnumber2.Text, txtnumber3.Text);
         TriangleType  ts    = model.GetTriangleType(model);
         lblResult.Text      = ts.ToString();
         lblResult.ForeColor = Color.Green;
     }
     else
     {
         lblResult.Text      = "Error with Form data";
         lblResult.ForeColor = Color.Red;
     }
 }