public static void Main(string[] args) { try { IFigure firstFigure = Figure.Parse(Console.ReadLine()); IFigure secondFigure = Figure.Parse(Console.ReadLine()); Console.WriteLine($"{firstFigure.GetPerimeter():F3} and {secondFigure.GetPerimeter():F3}"); Console.WriteLine($"{firstFigure.GetSquare():F3} and {secondFigure.GetSquare():F3}"); Console.WriteLine($"{firstFigure.CompareByPerimeter(secondFigure) > 0}"); Console.WriteLine($"{firstFigure.CompareBySquare(secondFigure) > 0}"); } catch (ArgumentException argumentException) { Console.WriteLine(argumentException.Message); } }
public void Test(IFigure figure, double expectedArea, double expectedPerimeter) { Assert.That(figure.GetArea(), Is.EqualTo(expectedArea)); Assert.That(figure.GetPerimeter(), Is.EqualTo(expectedPerimeter)); }
public void CheckPerimeter(double expectPerimeter, params double[] values) { IFigure figure = factory.CreateFigure(Material.Film, values); Assert.AreEqual(expectPerimeter, figure.GetPerimeter(), 0.00001f); }