private static void CheckTriangle(double side1, double side2, double side3, double expected) { double area = AreaCalculator.CalculateTriangleArea(side1, side2, side3); Assert.IsFalse(double.IsNaN(area)); AssertKindaEqual(expected, area); area = AreaCalculator.CalculateTriangleArea(side1, side3, side2); Assert.IsFalse(double.IsNaN(area)); AssertKindaEqual(expected, area); area = AreaCalculator.CalculateTriangleArea(side2, side1, side3); Assert.IsFalse(double.IsNaN(area)); AssertKindaEqual(expected, area); area = AreaCalculator.CalculateTriangleArea(side2, side3, side1); Assert.IsFalse(double.IsNaN(area)); AssertKindaEqual(expected, area); area = AreaCalculator.CalculateTriangleArea(side3, side1, side2); Assert.IsFalse(double.IsNaN(area)); AssertKindaEqual(expected, area); area = AreaCalculator.CalculateTriangleArea(side3, side2, side1); Assert.IsFalse(double.IsNaN(area)); AssertKindaEqual(expected, area); }
private static void CheckTriangleNan(double side1, double side2, double side3) { double area = AreaCalculator.CalculateTriangleArea(side1, side2, side3); Assert.IsTrue(double.IsNaN(area)); area = AreaCalculator.CalculateTriangleArea(side1, side3, side2); Assert.IsTrue(double.IsNaN(area)); area = AreaCalculator.CalculateTriangleArea(side2, side1, side3); Assert.IsTrue(double.IsNaN(area)); area = AreaCalculator.CalculateTriangleArea(side2, side3, side1); Assert.IsTrue(double.IsNaN(area)); area = AreaCalculator.CalculateTriangleArea(side3, side1, side2); Assert.IsTrue(double.IsNaN(area)); area = AreaCalculator.CalculateTriangleArea(side3, side2, side1); Assert.IsTrue(double.IsNaN(area)); }