public void Test_Tringle_Area() { GeometricFigures.Triangle treygolnik = new GeometricFigures.Triangle(5, 5, 6); treygolnik.getAreaTriangle(); int d = 12; Assert.AreEqual(d, treygolnik.getAreaTriangle()); }
public void TestAreaTriangleNegative(int a, int b, int c) { Assert.Throws <Exception>(() => { var triangle = new GeometricFigures.Triangle(a, b, c); var actualsq = triangle.getAreaTriangle(); }, "Exception is expected"); }
public void TestGetAreaTrianglePositive(int a, int b, int c) { double delta = 0.05; { double p = (double)(a + b + c) / 2; double expectedsq = Math.Sqrt(p * (p - a) * (p - b) * (p - c)); GeometricFigures.Triangle square = new GeometricFigures.Triangle(a, b, c); double actualsq = square.getAreaTriangle(); Assert.AreEqual(expectedsq, actualsq, delta, "It doesn't work with arguments ={0},{1},{2}", a, b, c); } }