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 Test_Tringle_Area() { GeometricFigures.Triangle treygolnik = new GeometricFigures.Triangle(5, 5, 6); treygolnik.getAreaTriangle(); int d = 12; Assert.AreEqual(d, treygolnik.getAreaTriangle()); }
public void Test_Tringle_Lenght() { GeometricFigures.Triangle treygolnik = new GeometricFigures.Triangle(6, 2, 3); treygolnik.getLengthTriangle(); int d = 11; Assert.AreEqual(d, treygolnik.getLengthTriangle()); }
public void TestGetLengthTrianglePositive(int a, int b, int c) { double delta = 0.05; { double expectedsq = a + b + c; GeometricFigures.Triangle triangle = new GeometricFigures.Triangle(a, b, c); double actualsq = triangle.getLengthTriangle(); Assert.AreEqual(expectedsq, actualsq, delta, "It doesn't work with arguments = {0},{1},{2}", a, b, c); } }
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); } }