Exemple #1
0
        public bool SalesIsCorrectlyCalculated(Pants.PantsAttr pants)
        {
            var newestLine   = CountSalesRecordLines();
            var productPrice =
                int.Parse(_driverInUse.FindElement(
                              By.XPath("//tbody/tr[" + newestLine + "]/td[3]")).Text);
            var discountPrice =
                int.Parse(_driverInUse.FindElement(
                              By.XPath("//tbody/tr[" + newestLine + "]/td[4]")).Text);
            var totalPrice =
                int.Parse(_driverInUse.FindElement(
                              By.XPath("//tbody/tr[" + newestLine + "]/td[5]")).Text);

            if (productPrice == pants.ProductPrice)
            {
                if (discountPrice == pants.DiscountPrice)
                {
                    if (totalPrice == pants.TotalPrice)
                    {
                        return(true);
                    }
                    return(false);
                }
                return(false);
            }
            throw new Exception("Product price for " + pants.ProductName + " does not match spec!");
        }
Exemple #2
0
 private void SelectPants(Pants.PantsAttr pants)
 {
     if (ElementHelper.ValidateElement(_productIdSelector, _productIdSelector.GetAttribute("Name")))
     {
         _productIdSelector.Click();
         var selectElement = new SelectElement(_productIdSelector);
         selectElement.SelectByText(pants.ProductName);
     }
 }
Exemple #3
0
 public void PressToCreateSales(Pants.PantsAttr pants)
 {
     if (ElementHelper.ValidateElement(_customerName, _customerName.GetAttribute("Name")))
     {
         _customerName.SendKeys(pants.CustomerName);
     }
     if (ElementHelper.ValidateElement(_createSalesButton, _createSalesButton.GetAttribute("Name")))
     {
         _createSalesButton.Click();
     }
     Thread.Sleep(1500);
 }
Exemple #4
0
        public bool SalesIsCreated(Pants.PantsAttr pants)
        {
            var newestLine = CountSalesRecordLines();
            var pantType   =
                _driverInUse.FindElement(
                    By.XPath("//tbody/tr[" + newestLine + "]/td[1]")).Text;
            var customerName =
                _driverInUse.FindElement(
                    By.XPath("//tbody/tr[" + newestLine + "]/td[2]")).Text;

            if (pantType.Contains(pants.ProductName) && customerName.Contains(pants.CustomerName))
            {
                return(true);
            }
            throw new Exception("Sales record for " + pants.CustomerName + " not found!");
        }
Exemple #5
0
 public void SelectPantsProduct(Pants.PantsAttr pants)
 {
     SelectPants(pants);
     Thread.Sleep(1500);
 }
Exemple #6
0
 public void InitProductIdSelector(Pants.PantsAttr pants)
 {
     SelectPantsProduct(pants);
 }