public void CircleSquareCheck() { double radius = 4; double expected = Math.PI * Math.Pow(radius, 2); double actual = GeometryLib.GetSquare(radius); Assert.AreEqual(expected, actual, 0.001, "Square uncorrect"); }
public void TriangleSquareCheck() { double a = 4, b = 5, c = 6; double p = (a + b + c) / 2; double expected = Math.Sqrt(p * (p - a) * (p - b) * (p - c)); double actual = GeometryLib.GetSquare(a, b, c); Assert.AreEqual(expected, actual, 0.001, "Square uncorrect"); }
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); }