Ejemplo n.º 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);
        }
Ejemplo n.º 2
0
        public void CheckNegativeValues()
        {
            String Answer = TriangleSolver.Analyze(2, -5, 2);

            Assert.AreEqual("Negative values cannot be computed", Answer);
        }
Ejemplo n.º 3
0
        public void CheckValuesUpperLimit()
        {
            String Answer = TriangleSolver.Analyze(10001, 5, 2);

            Assert.AreEqual("Values cannot exceed 1000", Answer);
        }
Ejemplo n.º 4
0
        public void CheckValidTriangle()
        {
            String Answer = TriangleSolver.Analyze(0, 0, 0);

            Assert.AreEqual("This does not form a triangle", Answer);
        }
Ejemplo n.º 5
0
        public void CheckScalene()
        {
            String Answer = TriangleSolver.Analyze(1, 2, 3);

            Assert.AreEqual("Your Triangle is Scalene", Answer);
        }
Ejemplo n.º 6
0
        public void CheckIsoceles()
        {
            String Answer = TriangleSolver.Analyze(1, 2, 1);

            Assert.AreEqual("Your Triangle is Isoceles", Answer);
        }
Ejemplo n.º 7
0
        public void CheckEqualateral()
        {
            String Answer = TriangleSolver.Analyze(2, 2, 2);

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