public void GetArea1_TriangleException()
        {
            Shape_ shape = new Triangle_ {
                Side = 10
            };

            Assert.Throws <NotSupportedException>(() => GetArea_(shape));
        }
Example #2
0
        static void Main(string[] args)
        {
            Console.Write("Enter the task num: ");
            int n = Int32.Parse(Console.ReadLine());

            switch (n)
            {
            //Explicit, implicit
            case 1:
            {
                Counter c = new Counter()
                {
                    Second = 666
                };
                Console.WriteLine((int)c);
            }
            break;

            //+
            case 2:
            {
                Money myMoney  = new Money(100, "USD");
                Money yorMoney = new Money(100, "USD");

                decimal total = myMoney.Amount + yorMoney.Amount;

                Money totalSum = myMoney + yorMoney;
            }
            break;

            case 3:
            {
                Money myMoney  = new Money(100, "USD");
                Money yorMoney = new Money(100, "USD");
                myMoney++;
                Console.WriteLine(myMoney);
            }
            break;


            //==,!=,true, false
            case 4:
            {
                MyArr a = new MyArr(2, 4, 5);
                MyArr b = new MyArr(2, 4, 5);
                if (a == b)
                {
                    Console.WriteLine("match");
                }
                else
                {
                    Console.WriteLine("no match");
                }

                if (a)
                {
                }
            }
            break;

            //Point
            case 5:
            {
                Point.Point a = new Point.Point(2, 2);
                a++;
                Console.WriteLine(a);
                Console.WriteLine("--------------------------------------");
                a--;
                Console.WriteLine(a);
                Console.WriteLine("--------------------------------------");
                a = a + 4;
                Console.WriteLine(a);
                Console.WriteLine("--------------------------------------");

                string s = "1.2";
                a = (Point.Point)s;
                Console.WriteLine(a);
                Console.WriteLine("--------------------------------------");
            }
            break;

            //Triangle
            case 6:
            {
                Triangle_ a = new Triangle_(2, 4, 7);
                a++;
                Console.WriteLine(a);
                Console.WriteLine("--------------------------------------");
                a--;
                Console.WriteLine(a);
                Console.WriteLine("--------------------------------------");
                a = a * 4;
                Console.WriteLine(a);
                Console.WriteLine("--------------------------------------");

                string s = "1.2.5";
                a = (Triangle_)s;
                Console.WriteLine(a);
                Console.WriteLine("--------------------------------------");
            }
            break;
            }
        }