示例#1
0
        public decimal?GetAmount()
        {
            decimal amount;

            if (AmountInput != null)
            {
                //Essayer dans les deux langues.
                if (!decimal.TryParse(AmountInput.Replace(',', '.'), out amount))
                {
                    if (!decimal.TryParse(AmountInput.Replace('.', ','), out amount))
                    {
                        return(null);
                    }
                }

                if (!AcceptDecimals)
                {
                    return((decimal)Math.Floor(amount));
                }

                return((decimal)Math.Round(amount, 2));
            }
            else
            {
                return(null);
            }
        }
示例#2
0
        void ReleaseDesignerOutlets()
        {
            if (AmountInput != null)
            {
                AmountInput.Dispose();
                AmountInput = null;
            }

            if (SignMessageButton != null)
            {
                SignMessageButton.Dispose();
                SignMessageButton = null;
            }

            if (SignTransactionButton != null)
            {
                SignTransactionButton.Dispose();
                SignTransactionButton = null;
            }

            if (TextInput != null)
            {
                TextInput.Dispose();
                TextInput = null;
            }

            if (ToAddressInput != null)
            {
                ToAddressInput.Dispose();
                ToAddressInput = null;
            }
        }
示例#3
0
 // User is able to convert 1 Swiss Franc to EURO successfully
 public void Story2ConvertSwissFrancToEuro()
 {
     TestContext.WriteLine("Convert Swiss Franc to EURO");
     NavigateToCurrencyConverter();
     if (IsElementFound(By.Id("westpac-iframe"), out IWebElement westpacFrame))
     {
         //switch to the westpac-iframe
         driver.SwitchTo().Frame(westpacFrame);
     }
     if (IsElementFound(By.Id("ConvertFrom"), out IWebElement ConvertFromDropDown))
     {
         ConvertFromDropDown.FindElement(By.XPath("//select[1]/option[9]")).Click();
     }
     if (IsElementFound(By.Id("ConvertTo"), out IWebElement ConvertToDropDown))
     {
         ConvertToDropDown.FindElement(By.XPath("//select[2]/option[5]")).Click();
     }
     if (IsElementFound(By.Id("Amount"), out IWebElement AmountInput))
     {
         AmountInput.SendKeys("1");
     }
     if (IsElementFound(By.Id("convert"), out IWebElement ConvertButton))
     {
         ConvertButton.Click();
         String ActualText = "";
         if (IsElementFound(By.Id("resultsdiv"), out IWebElement ResultText))
         {
             ActualText = ResultText.Text;
         }
         String FailedMessage = "failed to convert Swiss Franc to Euro";
         Assert.IsTrue(ActualText.Contains("1 Swiss Franc"), FailedMessage);
         Assert.IsTrue(ActualText.Contains("Euro"), FailedMessage);
         Assert.IsTrue(ActualText.Contains("Would you like to make another calculation"), FailedMessage);
     }
 }