// This method with will verify the AccountId textfield
        public bool VerifySearchByAccountId(string accountId)
        {
            bool flag = false;
            int  totalCountOfAccountItemsBeforeSearch;
            int  totalCountOfAccountItemsAfterSearch;

            try
            {
                totalCountOfAccountItemsBeforeSearch = totalCountOfTradeItems();
                ClickOnShowSearchButton();
                EnterAccountId(accountId);
                ClickOnSearchButton();
                Thread.Sleep(2000);
                totalCountOfAccountItemsAfterSearch = totalCountOfTradeItems();

                if (!totalCountOfAccountItemsBeforeSearch.Equals(totalCountOfAccountItemsAfterSearch))
                {
                    flag = true;
                }

                if (flag)
                {
                    logger.LogCheckPoint(String.Format(LogMessage.VerifySearchByAccountIdPassed, accountId));
                }
                else
                {
                    logger.LogCheckPoint(String.Format(LogMessage.VerifySearchByAccountIdFailed, accountId));
                }
                UserSetFunctions.Clear(AccountIdTextField());
                driver.Navigate().Refresh();
                Thread.Sleep(1000);
                ClickOnShowSearchButton();
            }
            catch (Exception)
            {
                throw;
            }
            return(flag);
        }
Beispiel #2
0
        //This method will perform a simple Block Buy trade operation and verify the fields(Used for TC_33)
        public void VerifyElementsAndSubmitBlockTradeReport(string counterPartyPrice, string wrongCounterPrice, string producBoughtPrice, string productSoldPrice)
        {
            string ExpectedCounterPartyMsg = string.Format(LogMessage.CounterPartyErrorMsgVerified, wrongCounterPrice);

            try
            {
                OrderEntryPage orderEntryPage = new OrderEntryPage(driver, logger);
                UserSetFunctions.EnterText(CounterPartyTextField(), wrongCounterPrice);
                UserSetFunctions.EnterText(ProductBoughtTextField(), producBoughtPrice);
                UserSetFunctions.EnterText(ProductSoldTextField(), productSoldPrice);
                Thread.Sleep(2000);
                SubmitReportButton();
                Thread.Sleep(2000);
                ConfirmSubmitReportButton();
                string AcceptedCountrPartyErrorMsg = CounterPartyErrorMsg().Text;

                //This will verify if the counterParty error message is coming
                try
                {
                    Assert.Equal(ExpectedCounterPartyMsg, AcceptedCountrPartyErrorMsg);
                    logger.LogCheckPoint(string.Format(LogMessage.CounterPartyErrorMsgVerified, wrongCounterPrice));
                }
                catch (Exception)
                {
                    logger.LogCheckPoint(string.Format(LogMessage.CounterPartyErrorMsgVerified));
                }
                Thread.Sleep(2000);
                UserSetFunctions.Clear(CounterPartyTextField());
                UserSetFunctions.EnterText(CounterPartyTextField(), counterPartyPrice);
                Thread.Sleep(2000);
                LockedInCheckBoxButton();
                Thread.Sleep(2000);
                string productBought       = ProductBoughtTextField().GetAttribute(string.Format(LogMessage.ProductBoughtTextFieldAttributeValue));
                double actualProductBought = double.Parse(productBought);

                string productSold       = ProductSoldTextField().GetAttribute(string.Format(LogMessage.ProductSoldTextFieldAttributeValue));
                double actualProductSold = double.Parse(productSold);

                string orderTotalAmountStringValue = OrderTotalAmount().Text;
                string orderTotalAmountdigits      = orderTotalAmountStringValue.Split(" ")[1];
                double doubleOrderTotalPrice       = Double.Parse(orderTotalAmountdigits);

                string receivedAmountStringValue = ReceivedAmount().Text;
                string receivedAmountdigits      = receivedAmountStringValue.Split(" ")[1];
                double doubleReceivedPrice       = Double.Parse(receivedAmountdigits);

                string feeAmountStringValue = FeeAmount().Text;
                string feeAmountdigits      = feeAmountStringValue.Split(" ")[1];
                double doubleFeePrice       = Double.Parse(feeAmountdigits);

                double receivedBTCAmount = actualProductBought - doubleFeePrice;

                //This will verify if product Sold is equal to Order Total amount.
                try
                {
                    Assert.Equal(actualProductSold, doubleOrderTotalPrice);
                    logger.LogCheckPoint(string.Format(LogMessage.ProductSoldEqualsToOrderTotal, actualProductSold, doubleOrderTotalPrice));
                }
                catch (Exception)
                {
                    logger.LogCheckPoint(string.Format(LogMessage.ProductSoldNotEqualsToOrderTotal, actualProductBought, doubleOrderTotalPrice));
                }

                //This will verify if Receiver amount is deducted after fee.
                try
                {
                    Assert.Equal(receivedBTCAmount, doubleOrderTotalPrice);
                    logger.LogCheckPoint(string.Format(LogMessage.VerifiedReceivedBTCAmountAfterFeeDeductingPassed, receivedBTCAmount, actualProductBought));
                }
                catch (Exception)
                {
                    logger.LogCheckPoint(string.Format(LogMessage.VerifiedReceivedBTCAmountAfterFeeDeductingFailed, receivedBTCAmount, doubleFeePrice));
                }
                Thread.Sleep(2000);
            }
            catch (Exception e)
            {
                throw e;
            }
        }