Advertisement
RMarK0

Тестовое задание Main

Jun 10th, 2020
238
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.95 KB | None | 0 0
  1. class Program
  2.     {
  3.         static void Main(string[] args)
  4.         {
  5.             IShape shape = new Circle(10);
  6.             Console.WriteLine(shape.Area);
  7.             Assert(Math.Abs(shape.Area - 314.159265358979) < 0.00000000001);
  8.  
  9.             Console.WriteLine(shape.Perimeter);
  10.             Assert(Math.Abs(shape.Perimeter - 62.8318530718) < 0.00000000001);
  11.  
  12.             IShape shape2 = new Triangle(3,4,5);
  13.             Console.WriteLine(shape2.Area);
  14.             Triangle temp = (Triangle) shape2;
  15.             if (temp.IsRight)
  16.                 Console.WriteLine("shape2 is right");
  17.            
  18.             Assert(Math.Abs(shape2.Area - 6) < 0.00000000001);
  19.  
  20.             Console.ReadLine();
  21.         }
  22.     }
  23. // Это метод Main, который я писал для тестирования библиотеки. К сожалению, проблему с красивым даункастом решить не удалось. ¯\_(ツ)_/¯
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement