コード例 #1
0
    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);
        }
    }
コード例 #2
0
ファイル: FigureTests.cs プロジェクト: Wanderer19/CourseWork
 public void Test(IFigure figure, double expectedArea, double expectedPerimeter)
 {
     Assert.That(figure.GetArea(), Is.EqualTo(expectedArea));
     Assert.That(figure.GetPerimeter(), Is.EqualTo(expectedPerimeter));
 }
コード例 #3
0
        public void CheckPerimeter(double expectPerimeter, params double[] values)
        {
            IFigure figure = factory.CreateFigure(Material.Film, values);

            Assert.AreEqual(expectPerimeter, figure.GetPerimeter(), 0.00001f);
        }