static void Main(string[] args) { Console.WriteLine("Введите параметры"); string[] paramList = Console.ReadLine().Split(); double square; bool isRight = false; if (paramList.Length == 1) { square = GeometryLib.GetSquare(double.Parse(paramList[0])); } else { square = GeometryLib.GetSquare(double.Parse(paramList[0]), double.Parse(paramList[1]), double.Parse(paramList[2])); isRight = GeometryLib.IsRightTriangle(double.Parse(paramList[0]), double.Parse(paramList[1]), double.Parse(paramList[2])); } Console.WriteLine(square); Console.WriteLine(isRight); }
public void TriangleRightCheck() { double a = 4, b = 5, c = 6; double p = (a + b + c) / 2; bool expected; if (a >= b && a >= c) { expected = a == Math.Sqrt(Math.Pow(b, 2) + Math.Pow(c, 2)); } else if (b >= a && b >= c) { expected = b == Math.Sqrt(Math.Pow(a, 2) + Math.Pow(c, 2)); } else { expected = c == Math.Sqrt(Math.Pow(a, 2) + Math.Pow(b, 2)); } bool actual = GeometryLib.IsRightTriangle(a, b, c); Assert.AreEqual(expected, actual, "Right uncorrect"); }