Пример #1
0
 public static void CalculateTwoNumbers()
 {
     Console.WriteLine("Adding {0} and {1} gives {2}", 5, 7, TrainingFunctions.Calculator(5, 7, "+"));
     Console.WriteLine("Subtracting {0} from {1} gives {2}", 6, 20, TrainingFunctions.Calculator(20, 6, "-"));
     Console.WriteLine("Dividing {0} by {1} gives {2}", 120, 12, TrainingFunctions.Calculator(120, 12, "/"));
     Console.WriteLine("Multiplying {0} by {1} gives {2}", 8, 9, TrainingFunctions.Calculator(8, 9, "*"));
     Console.WriteLine("Multiplying {0} by {1} gives {2}", 8, 9, TrainingFunctions.Calculator(8, 9, "@"));
 }
Пример #2
0
 public static void UseString()
 {
     if (TrainingFunctions.GetString() == "Go")
     {
         Console.WriteLine("Expected string was returned");
     }
     else
     {
         Console.WriteLine("Expected string was not returned");
     }
 }
Пример #3
0
        public static void UseInteger()
        {
            int counter = 0;

            while (TrainingFunctions.GetInteger() == 5)
            {
                Console.WriteLine("Expected integer was returned");

                if (counter == 2)
                {
                    break;
                }

                counter++;
            }
        }
Пример #4
0
        public static void GatherLogin()
        {
            driver = new ChromeDriver();
            driver.Manage().Window.Maximize();
            driver.Navigate().GoToUrl("https://engagement.int.ert.com");

            TrainingFunctions.LoginToGather("ccraiser.studyall", "User1234", driver, "RanjitTest2");

            int Calc = TrainingFunctions.PreCalc(1, 10);

            Console.WriteLine(Calc);

            //Close Browser
            GenericFunctions.Wait(2);
            driver.Quit();
        }
Пример #5
0
        public static void GoogleCalc()
        {
            driver = new ChromeDriver();
            driver.Manage().Window.Maximize();
            driver.Navigate().GoToUrl("https://www.google.co.uk/search?&q=calc");
            int counter = 0;


            //Wait for the Google calculator to be visible
            while (!driver.FindElement(By.Id("cwmcwd")).Displayed)
            {
                Console.WriteLine(counter.ToString());
                GenericFunctions.Wait(1);

                if (counter == 60)
                {
                    break;
                }

                counter++;
            }

            // Type some numbers testing
            TrainingFunctions.CalculatorButton("4", driver, 0);
            TrainingFunctions.CalculatorButton("+", driver, 1);
            TrainingFunctions.CalculatorButton("8", driver, 2);
            TrainingFunctions.CalculatorButton("=", driver, 3);
            //TrainingFunctions.CalculatorButton("−", driver);
            //TrainingFunctions.CalculatorButton("1", driver);
            //TrainingFunctions.CalculatorButton("=", driver);
            //TrainingFunctions.CalculatorButton("+", driver);
            //TrainingFunctions.CalculatorButton("4", driver);
            //TrainingFunctions.CalculatorButton("=", driver);
            //TrainingFunctions.CalculatorButton("×", driver);
            //TrainingFunctions.CalculatorButton("5", driver);
            //TrainingFunctions.CalculatorButton("=", driver);


            // Report the result
            Console.WriteLine("Google Calc Answer: " + TrainingFunctions.GetGoogleCalcAnswer(driver));

            if (TrainingFunctions.GetExpectedAnswer() == 9999)
            {
                Console.WriteLine("ERROR: Invalid Operator specified");
            }
            else
            {
                Console.WriteLine("Expected Answer: " + TrainingFunctions.GetExpectedAnswer());

                if (TrainingFunctions.GetGoogleCalcAnswer(driver) == TrainingFunctions.GetExpectedAnswer())
                {
                    Console.WriteLine("PASS: Google calculator answer agrees with Expected answer");
                }
                else
                {
                    Console.WriteLine("FAIL: Google calculator answer does not agree with Expected answer");
                }
            }

            TrainingFunctions.ClearKeyPressArray();


            //Close Browser
            GenericFunctions.Wait(3);
            driver.Quit();
        }