Esempio n. 1
0
        public void check_forinput7_4_3expectedResultEqualsScalene()
        {
            //Arrange
            int    int1           = 7;
            int    int2           = 4;
            int    int3           = 3;
            string expectedResult = "Scalene";

            TriangleSolver t = new hinaliA2QA.TriangleSolver();

            //Act
            string result = t.Analyze(int1, int2, int3);

            //Assert
            Assert.AreEqual(result, expectedResult);
        }
Esempio n. 2
0
        public void check_forinput4_7_4expectedResultEqualsIsosceles()
        {
            //Arrange
            int    int1           = 4;
            int    int2           = 7;
            int    int3           = 4;
            string expectedResult = "Isosceles";

            TriangleSolver t = new hinaliA2QA.TriangleSolver();

            //Act
            string result = t.Analyze(int1, int2, int3);

            //Assert
            Assert.AreEqual(result, expectedResult);
        }
Esempio n. 3
0
        public void check_forinput2_2_2expectedResultEqualsEquilateral()
        {
            //Arrange
            int    int1           = 2;
            int    int2           = 2;
            int    int3           = 2;
            string expectedResult = "Equilateral";

            TriangleSolver t = new hinaliA2QA.TriangleSolver();

            //Act
            string result = t.Analyze(int1, int2, int3);

            //Assert
            Assert.AreEqual(result, expectedResult);
        }
Esempio n. 4
0
        public void Run()
        {
            string str1, str2, str3;
            int    int1, int2, int3;
            char   choice;

            do
            {
                Console.WriteLine("\nMenu..........");
                Console.WriteLine("1. Enter triangle dimensions:");
                Console.WriteLine("2. Exit");
                Console.Write("Please Enter your choice:");
                choice = Console.ReadKey().KeyChar;

                switch (choice)
                {
                case '1':

                    case1 : Console.Write("\n Enter 1st dimension: ");
                    str1 = Console.ReadLine();
                    if (!ValidateInput(str1))
                    {
                        goto case1;
                    }

                    case2 : Console.Write("Enter 2nd dimension: ");
                    str2 = Console.ReadLine();
                    if (!ValidateInput(str2))
                    {
                        goto case2;
                    }

                    case3 : Console.Write("Enter 3rd dimension: ");
                    str3 = Console.ReadLine();
                    if (!ValidateInput(str3))
                    {
                        goto case3;
                    }
                    int1 = int.Parse(str1);
                    int2 = int.Parse(str2);
                    int3 = int.Parse(str3);

                    if (int1 + int2 > int3 && int1 + int3 > int2 && int2 + int3 > int1)
                    {
                        string T = triangle.Analyze(int1, int2, int3);

                        Console.WriteLine("Type of Triandle: {0} triangle.", T);
                        break;
                    }
                    else
                    {
                        Console.WriteLine("this is not the valid triangle.");
                        break;
                    }

                case '2':
                    break;

                default:
                    Console.WriteLine("\n Enter correct choice");
                    break;
                }
            } while (choice != '2');
        }