Пример #1
0
        /// <summary>
        /// Price, Days, Hours, Minutes
        /// </summary>

        /*public struct ParkingResults
         * {
         *  public int price, days, hours, minutes;
         *  public ParkingResults(int p1,int p2, int p3, int p4)
         *  {
         *      price = p1;
         *      days = p2;
         *      hours = p3;
         *      minutes = p4;
         *  }
         * }*/

        public ParkingResults returnResults()
        {
            ParkingResults pr = new ParkingResults();

            // Fill with results
            IWebElement ParkingPrice = Browsers.getDriver.FindElement(By.XPath("//span[@class='SubHead']/b"));

            pr.price = Int32.Parse(ParkingPrice.Text.Remove(0, 2).Replace(".00", ""));

            // Parking time slicing [(](.*) Days, (.*) Hours, (.*) Minutes
            //Regex rx = new Regex(@"[(](.*) Days, (.*) Hours, (.*) Minutes");
            IWebElement     ParkingTime = Browsers.getDriver.FindElement(By.XPath("//span[@class='BodyCopy']/b"));
            MatchCollection mc          = Regex.Matches(ParkingTime.Text, @"\d+");

            pr.days    = Int32.Parse(mc[0].ToString());
            pr.hours   = Int32.Parse(mc[1].ToString());
            pr.minutes = Int32.Parse(mc[2].ToString());

            return(pr);
        }
Пример #2
0
        public void ThenIGotTheFollowingPriceAndMetrics(int money, int days, int hours, int minutes)
        {
            ParkingResults expResults = new ParkingResults(money, days, hours, minutes);

            Assert.AreEqual(expResults.ToString(), Pages.home.returnResults().ToString());
        }