コード例 #1
0
        /// <summary>
        /// Main method that executes on Load
        /// </summary>
        /// <param name="args"></param>
        static void Main(string[] args)
        {
            int    a;
            int    b;
            int    c;
            string input;

            do
            {
                Console.WriteLine("\n1. Enter Triangle Dimensions: " + "\n" + "2. Exit" + "\n");
                input = Console.ReadLine();

                try
                {
                    if (input == "1")
                    {
                        Console.WriteLine("Enter 3 Numbers" + "\n");

                        Console.WriteLine("Enter First Number: ");
                        a = int.Parse(Console.ReadLine());

                        Console.WriteLine("Enter Second Number ");
                        b = int.Parse(Console.ReadLine());

                        Console.WriteLine("Enter Third Number ");
                        c = int.Parse(Console.ReadLine());


                        string answer = TriangleSolver.Analyze(a, b, c);
                        Console.WriteLine(answer);
                    }
                    if (input == "2")
                    {
                        break;
                    }
                }
                catch (Exception)
                {
                    Console.WriteLine("The values entered are not valid");
                }
            } while (true);
        }
コード例 #2
0
        public void CheckNegativeValues()
        {
            String Answer = TriangleSolver.Analyze(2, -5, 2);

            Assert.AreEqual("Negative values cannot be computed", Answer);
        }
コード例 #3
0
        public void CheckValuesUpperLimit()
        {
            String Answer = TriangleSolver.Analyze(10001, 5, 2);

            Assert.AreEqual("Values cannot exceed 1000", Answer);
        }
コード例 #4
0
        public void CheckValidTriangle()
        {
            String Answer = TriangleSolver.Analyze(0, 0, 0);

            Assert.AreEqual("This does not form a triangle", Answer);
        }
コード例 #5
0
        public void CheckScalene()
        {
            String Answer = TriangleSolver.Analyze(1, 2, 3);

            Assert.AreEqual("Your Triangle is Scalene", Answer);
        }
コード例 #6
0
        public void CheckIsoceles()
        {
            String Answer = TriangleSolver.Analyze(1, 2, 1);

            Assert.AreEqual("Your Triangle is Isoceles", Answer);
        }
コード例 #7
0
        public void CheckEqualateral()
        {
            String Answer = TriangleSolver.Analyze(2, 2, 2);

            Assert.AreEqual("Your Triangle is Equilateral", Answer);
        }