示例#1
0
        private void Submit_Click(object sender, RoutedEventArgs e)
        {
            var model = Form.DataContext as UserViewModel;

            if (model != null)
            {
                ProgressUpload.IsIndeterminate = true;
                try
                {
                    UserFunctions.AddUser(this.TextPassword.Password, model.Login, model.Name, model.Surname,
                                          (byte)UserPrivlidgesExtensions.GetValueFromDescription(model.Permission));
                }
                catch (Exception)
                {
                    MessageBox.Show("An error occured, please check your inputs.");
                }
                finally
                {
                    ProgressUpload.IsIndeterminate = false;
                }
            }
        }
示例#2
0
 public void VerifyBuyStopOrder()
 {
     try
     {
         UserFunctions   userFunctionality  = new UserFunctions(output);
         VerifyOrdersTab objVerifyOrdersTab = new VerifyOrdersTab(driver, output);
         //objVerifyOrdersTab.VerifyOpenOrdersTab(instrumentText, "Buy", 1, 0.9);
         Assert.True(objVerifyOrdersTab.VerifyOpenOrdersTab(instrumentText, "Buy", 1, 0.9));
         logger.Info("Verified buy stop Order test passed successfully");
     }
     catch (Exception e)
     {
         logger.Error("Verify Buy Stop Order Failed");
         logger.Error(e.StackTrace);
         throw e;
     }
     finally
     {
         UserFunctions userFunctionality = new UserFunctions(output);
         userFunctionality.LogOut();
     }
 }
        public void TC44_VerifyCreateAPIKey()
        {
            try
            {
                TestProgressLogger.StartTest();
                UserFunctions   userFunctions    = new UserFunctions(TestProgressLogger);
                UserSettingPage userSettingsPage = new UserSettingPage(driver, TestProgressLogger);
                userFunctions.LogIn(TestProgressLogger, Const.USER1);
                // Login -> navigate to User Settings and Select API Key
                Assert.True((userSettingsPage.SelectAPIKey()), LogMessage.CreateAPIKeyBtnIsNotPresent);
                TestProgressLogger.LogCheckPoint(String.Format(LogMessage.CreateAPIKeyBtnIsPresent));
                // Verify that the checkboxes are present
                Assert.True((userSettingsPage.VerifyAPIKeyCheckboxesArePresent()), LogMessage.APIKeyCheckboxesAreNotPresent);
                TestProgressLogger.LogCheckPoint(String.Format(LogMessage.APIKeyCheckboxesArePresent));
                // Create API key and verify the key is created successfully
                Assert.True((userSettingsPage.CreateAndVerifyAPIKey()), LogMessage.APIKeyCreatedFailureMsg);
                TestProgressLogger.LogCheckPoint(String.Format(LogMessage.APIKeyCreatedSuccessMsg));
            }
            catch (NoSuchElementException ex)
            {
                TestProgressLogger.TakeScreenshot();
                TestProgressLogger.LogCheckPoint(ex.Message + ex.StackTrace);
                TestProgressLogger.LogError(LogMessage.CreateAPIKeyFailed, ex);

                throw;
            }
            catch (Exception e)
            {
                TestProgressLogger.TakeScreenshot();
                TestProgressLogger.LogCheckPoint(e.Message + e.StackTrace);
                TestProgressLogger.LogError(LogMessage.CreateAPIKeyFailed, e);
                throw e;
            }
            finally
            {
                TestProgressLogger.EndTest();
            }
        }
        /// <summary>
        /// This is a helper method to the User controllers Register Endpoint
        /// </summary>
        /// <param name="data">The Request Model coming in</param>
        /// <param name="Db">The Database context from the Dependency Injector</param>
        /// <returns>
        /// 0. Ok
        /// 1. Error
        /// </returns>
        internal static int RegisterUser(RegisterUserRequestModel data, DBContext Db)
        {
            try
            {
                IUserFunctions userFunctions = new UserFunctions(Db);

                //Hashing password before storing
                string PasswordHashed = Helpers.Crypto.GetHashStringsFromStrings(data.Password);

                ///Creating user entity from input data
                Users NewUser = new Users()
                {
                    Id             = new Random().Next(0, 9999999),
                    CreatedOn      = DateTime.Now,
                    Email          = data.Email,
                    Name           = data.Name,
                    Password       = PasswordHashed,
                    Phone          = data.Phone,
                    Username       = data.Username,
                    LastModifiedOn = DateTime.Now
                };

                //Adding user to database
                int Result = userFunctions.AddUser(NewUser);

                if (Result == 2)
                {
                    //Handling the Exception
                    ExceptionHandler.Handle(userFunctions.LastException);
                }
                return(Result);
            }
            catch (Exception e)
            {
                ExceptionHandler.Handle(e);
                throw;
            }
        }
        public void TC47_VerifySingleReportTradeActivities()
        {
            string reportTypeValue;
            string startDate;
            string endDate;

            reportTypeValue = TestData.GetData("TC47_SingleReportTradeActivityValue");
            try
            {
                //Login as a User
                TestProgressLogger.StartTest();
                UserFunctions objUserFunctionality = new UserFunctions(TestProgressLogger);
                objUserFunctionality.LogIn(TestProgressLogger, Const.USER14);

                TradeReportsPage objTradeReportsPage = new TradeReportsPage(driver, TestProgressLogger);
                startDate = GenericUtils.GetCurrentDateMinusOne();
                endDate   = GenericUtils.GetCurrentDate();
                Assert.True(objTradeReportsPage.VerifySingleReportData(reportTypeValue, startDate, endDate));
                TestProgressLogger.LogCheckPoint(String.Format(LogMessage.VerifySingleReportTradeActivitiesPassed, reportTypeValue));
            }
            catch (NoSuchElementException ex)
            {
                TestProgressLogger.LogCheckPoint(ex.Message + ex.StackTrace);
                throw ex;
            }
            catch (Exception e)
            {
                TestProgressLogger.TakeScreenshot();
                TestProgressLogger.LogCheckPoint(String.Format(LogMessage.VerifySingleReportTradeActivitiesFailed, reportTypeValue));
                throw e;
            }
            finally
            {
                TestProgressLogger.EndTest();
                UserFunctions userFunctionality = new UserFunctions(TestProgressLogger);
                userFunctionality.LogOut();
            }
        }
        public void TC45_VerifyAffiliateProgram()
        {
            string userByID          = TestData.GetData("TC45_UserByID");
            string affiliateTagID    = TestData.GetData("TC45_AffiliateTagID");
            string verificationLevel = TestData.GetData("TC45_VerificationLevel");

            TestProgressLogger.StartTest();
            AdminFunctions       objAdminFunctions       = new AdminFunctions(TestProgressLogger);
            UserFunctions        userFunctions           = new UserFunctions(TestProgressLogger);
            AdminCommonFunctions objAdminCommonFunctions = new AdminCommonFunctions(TestProgressLogger);
            UserSettingPage      userSettingsPage        = new UserSettingPage(driver, TestProgressLogger);

            try
            {
                objAdminFunctions.AdminLogIn(TestProgressLogger);
                objAdminCommonFunctions.ClickOnUsersMenuLink();
                objAdminCommonFunctions.UserByIDText(userByID);
                objAdminCommonFunctions.OpenUserButton();
                objAdminCommonFunctions.AffiliateTagCreation(affiliateTagID);
                objAdminCommonFunctions.UserMenuBtn();
                objAdminFunctions.AdminLogOut();
                userFunctions.LogIn(TestProgressLogger, Const.USER12);
                Assert.True(userSettingsPage.VerifyAffiliateProgramFunctionality(driver, verificationLevel));
                TestProgressLogger.LogCheckPoint(String.Format(LogMessage.AffiliateProgramSuccessMsg));
            }
            catch (Exception e)
            {
                TestProgressLogger.TakeScreenshot();
                TestProgressLogger.LogError(LogMessage.AffiliateProgramFailureMsg, e);
                throw e;
            }
            finally
            {
                TestProgressLogger.EndTest();
                UserFunctions userFunctionality = new UserFunctions(TestProgressLogger);
                userFunctionality.LogOut();
            }
        }
        public bool CheckExpression(string expression)
        {
            int count = 0;

            foreach (var symbol in expression)
            {
                if ("()*/-+^".Contains(symbol.ToString()))
                {
                    count++;
                }
            }
            if (count > 50)
            {
                return(true);
            }
            var Elements = new List <PrimitiveElement>();

            Elements.AddRange(UserFunctions.ConvertAll(f => new Function(f.GetExpression)));
            Elements.AddRange(UserConstants.ConvertAll(c => new Argument(c.Name, c.Value)));
            Expression test = new Expression(expression, Elements.ToArray());

            return(!test.checkSyntax());
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            String rname;
            String raddress;

            if (!IsPostBack)
            {
                UserFunctions uf = new UserFunctions();
                rname = Session["Restaurant Name"].ToString();


                raddress = Session["Restaurant Address"].ToString();

                DBConnect objDB = new DBConnect();

                int     restid = uf.GetRestaurantID(rname, raddress);
                String  strSQL = "SELECT * From Reviews WHERE RestaurantID = '" + restid + "'";
                DataSet myDS   = objDB.GetDataSet(strSQL);

                gvReviews.DataSource = myDS;
                gvReviews.DataBind();
            }
        }
示例#9
0
        /// <summary>
        /// Initializes the task manager with the property values specified in the configuration file.
        /// </summary>
        public void Initialize()
        {
            this._taskThreads.Clear();

            var scheduleTasks = UserFunctions.GetReportTasks();

            //group by threads with the same seconds
            foreach (var scheduleTaskGrouped in scheduleTasks.GroupBy(x => x.Seconds))
            {
                //create a thread
                var taskThread = new TaskThread()
                {
                    Seconds = scheduleTaskGrouped.Key
                };
                foreach (var scheduleTask in scheduleTaskGrouped)
                {
                    var task = new Task(scheduleTask);
                    taskThread.AddTask(task);
                }

                this._taskThreads.Add(taskThread);
            }
        }
示例#10
0
        public async void GetPrintUser()
        {
            UserFunctions uf = new UserFunctions();
            User          u  = new User();

            try
            {
                int UserID = await uf.GetDriver(new Imc().ToBase64String(new Imc().ToByteArr(ScannedFingerPrint)));

                u = await uf.GetUser(UserID);


                firstnamelabel.Text = u.NationalRegInfo.FirstName;
                lastnamelabel.Text  = u.NationalRegInfo.LastName;
                ninlabel.Text       = u.NationalRegInfo.NIN;
                phonelabel.Text     = u.PhoneNumber;
                emaillabel.Text     = u.Email;
                UserId = u.ID;
            }
            catch
            {
            }
        }
示例#11
0
        [Fact]   //30
        public void VerifyPartiallyIOCAdvanceSellOrderMoreThanBidPrice()
        {
            try
            {
                UserFunctions userFunctionality = new UserFunctions(output);
                userFunctionality.LogIn();
                UserCommonFunctions.DashBoardMenuButton(driver);
                UserCommonFunctions.SelectInstrumentFromExchange("BTCUSD", driver);
                string quantity = UserCommonFunctions.GetQuantityFromOrderBook(driver);
                Thread.Sleep(5000);
                UserCommonFunctions.AdvanceOrder(driver);

                AdvancedOrderPage advanceorder = new AdvancedOrderPage(output);
                advanceorder.SelectBuyOrSellTab("Sell");
                advanceorder.SelectInstrumentsAndOrderType("BTCUSD", "Immediate or Cancel");
                string bidPrice          = advanceorder.GetAskOrBidPrice();
                string increasedQuantity = GenericUtils.IncreseAmount(quantity);
                string increaseBidPrice  = GenericUtils.IncreseAmount(bidPrice);;
                advanceorder.PlaceSellOrderWithImmediateOrCancelType(increasedQuantity, increaseBidPrice);

                string successMsg = UserCommonFunctions.GetTextOfSuccessfulMessage(driver, logger);
                Assert.Equal("Your order has been successfully added", successMsg);
                logger.Info("Verify Partially IOC Advance Sell Order More Than BidPrice Test passed successfully.");
            }
            catch (Exception e)
            {
                GenericUtils.GetScreenshot(driver, "VerifyPartiallyIOCAdvanceSellOrderMoreThanBidPrice");
                logger.Error("Verify Partially IOC Advance Sell Order More Than BidPrice Test Failed" + e);
                throw e;
            }
            finally
            {
                UserFunctions userFunctionality = new UserFunctions(output);
                UserCommonFunctions.CloseAdvancedOrderSection(driver, logger);
                userFunctionality.LogOut();
            }
        }
示例#12
0
            public async Task List()
            {
                string userlist = "None";

                if (UserFunctions.List().Count() > 1)
                {
                    userlist = "";
                }
                foreach (User user in UserFunctions.List())
                {
                    if (user.EventVerified)
                    {
                        userlist = userlist + Constants.IGuilds.Jordan(Context).Users.FirstOrDefault(x => x.Id == user.ID) + "\n";
                    }
                }

                EmbedBuilder embed = new EmbedBuilder();

                embed.WithTitle("List of Verified Users");
                embed.WithDescription(userlist);
                embed.WithColor(0, 255, 0);

                await ReplyAsync("", false, embed.Build());
            }
示例#13
0
        public ActionResult Index()
        {
            var ipAddress = UserFunctions.GetIPAddress();

            string sourceId   = Session["SourceID"].ToString();
            string sourceName = Session["SourceName"].ToString();
            string branch     = Session["Branch"].ToString();

            string requestBody = string.Empty;

            DateTime?startDate = null;

            DateTime?endDate = null;

            int logID = UserFunctions.InsertLog(ipAddress, "Home/Index", sourceId, sourceName, requestBody);

            UserFunctions.GetTellerTransactions(logID, sourceId, branch, startDate, endDate, out List <TellerTransaction> tellerTransactions, out decimal totalTransactionValue, out int totalTransactionVolume);

            ViewBag.TotalTransactionValue = totalTransactionValue;

            ViewBag.TotalTransactionVolume = totalTransactionVolume;

            UserFunctions.UpdateLogs(logID, StaticVariables.FAILSTATUS, JsonConvert.SerializeObject(tellerTransactions));

            ExportRequest exportRequest = new ExportRequest
            {
                StartDate = DateTime.Now.Date.ToString("dd/MM/yyy"),
                EndDate   = DateTime.Now.Date.AddDays(1).ToString("dd/MM/yyy")
            };

            ViewBag.fromDate = exportRequest.StartDate;

            ViewBag.toDate = exportRequest.EndDate;

            return(View(exportRequest));
        }
        public ActionResult Edit(int id)
        {
            var selectedCompany = CompanyCookie.SelectedCompany;

            if (string.IsNullOrEmpty(selectedCompany))
            {
                return(RedirectToAction("Index"));
            }

            var model = _db.ReportRecipients.Find(id);

            if (model == null)
            {
                return(HttpNotFound());
            }

            var viewModel = new ReportRecipientViewModel();

            viewModel.Id     = id;
            viewModel.AreaId = model.AreaId;
            viewModel.Emails = model.Emails;
            viewModel.Areas  = UserFunctions.GetAreasSelectList(_db, viewModel.AreaId);
            return(View(viewModel));
        }
示例#15
0
        public ActionResult DeleteUserProfile(User user)
        {
            UserFunctions.Delete(user);

            return RedirectToAction("Users", "Users");
        }
 public void AddNewFunction(IFunction function)
 {
     UserFunctions.Add(function);
 }
        public void TC40_WalletsWithdrawFiatcurrency()
        {
            try
            {
                string emailAddress;
                string gmailPassword;
                string amounttowithdraw;
                string currentUSDBalance;
                string fee;
                string remainingBalance;
                string amountToWithdrawAndFees;
                string expectedRemainingBalance;
                string holdBalance;
                string totalBalance;
                string availableBalance;
                string withdrawSuccessMsg;
                string holdBalanceAfterDeposit;
                string availableBalanceAfterDeposit;
                string expectedAvailableBalanceAfterDeposit;
                string expectedHoldBalanceAfterDeposit;
                string statusID;
                string linkUrl;
                string ticketStatus;
                string withdrawSuccess;
                string mailSubject;
                string totalBalanceAfterDeposit;
                string expectedTotalBalanceAfterDeposit;


                currencyName          = TestData.GetData("USDCurrency");
                comment               = TestData.GetData("TC40_Comment");
                amountOfUSDToWithdraw = TestData.GetData("USDAmount");
                fullName              = TestData.GetData("FullName");
                language              = TestData.GetData("TC40_Language");
                bankAddress           = TestData.GetData("TC40_BankAddress");
                bankAccountNumber     = TestData.GetData("TC40_BankAccountNumber");
                bankName              = TestData.GetData("TC40_BankName");
                swiftCode             = TestData.GetData("TC40_SwiftCode");
                withdrawStatus        = TestData.GetData("WithdrawStatus");
                emailAddress          = TestData.GetData("User_14EmailAddress");
                gmailPassword         = TestData.GetData("GmailUser_Test1Password");
                mailSubject           = TestData.GetData("GmailMailSubject_ConfirmYourWithdraw");
                ticketStatus          = TestData.GetData("FullyProcessedTicketStatus");

                TestProgressLogger.StartTest();
                UserFunctions userFunctions = new UserFunctions(TestProgressLogger);
                userFunctions.LogIn(TestProgressLogger, Const.USER15);
                TestProgressLogger.LogCheckPoint(String.Format(LogMessage.UserLoggedInSuccessfully, Const.USER15));

                UserCommonFunctions.DashBoardMenuButton(driver);
                UserCommonFunctions.NavigateToWallets(driver);
                TestProgressLogger.LogCheckPoint(String.Format(LogMessage.NavigateWalletsPage));

                WalletPage walletpage = new WalletPage();
                walletpage.ClickInstrumentDetails(driver, currencyName);
                walletpage.GetHoldAvailablePendingDepositTotalBalanceOnDetailsPage(driver);
                holdBalance      = walletpage.HoldBalanceDetailsPage;
                availableBalance = walletpage.AvailableBalanceDetailsPage;
                walletpage.ClickWithdrawButtonOnDetails(driver);

                walletpage.WithdrawUSD(driver, amountOfUSDToWithdraw, fullName, language, comment, bankAddress, bankAccountNumber, bankName, swiftCode);
                amounttowithdraw  = walletpage.GetAmountToWithdraw(driver);
                currentUSDBalance = walletpage.GetCurrentUSDBalance(driver);
                fee = walletpage.GetFee(driver);
                remainingBalance         = walletpage.GetRemainingBalance(driver);
                amountToWithdrawAndFees  = GenericUtils.GetSumFromStringAfterAddition(amounttowithdraw, fee);
                expectedRemainingBalance = GenericUtils.GetDifferenceFromStringAfterSubstraction(currentUSDBalance, amountToWithdrawAndFees);
                Assert.Equal(expectedRemainingBalance, GenericUtils.RemoveCommaFromString(remainingBalance));
                TestProgressLogger.LogCheckPoint(LogMessage.RemainingBalanceVerifiedOnBalanceSection);

                walletpage.ClickOnWithdrawUSDButton(driver);
                walletpage.VerifyWithdrawUSDOnConfirmationModal(driver, amountOfUSDToWithdraw, fullName, language, comment, bankAddress, bankAccountNumber, bankName, swiftCode, fee);
                walletpage.ClickOnConfirmUSDModalButton(driver);
                TestProgressLogger.LogCheckPoint(LogMessage.ConfirmationModalVerified);
                withdrawSuccessMsg = UserCommonFunctions.GetTextOfMessage(driver, TestProgressLogger);
                Assert.Equal(LogMessage.USDWithdrawSuccessMsg, withdrawSuccessMsg);

                walletpage.GetHoldAvailablePendingDepositTotalBalanceOnDetailsPage(driver);
                holdBalanceAfterDeposit              = walletpage.HoldBalanceDetailsPage;
                availableBalanceAfterDeposit         = walletpage.AvailableBalanceDetailsPage;
                totalBalanceAfterDeposit             = walletpage.TotalBalanceDetailsPage;
                expectedAvailableBalanceAfterDeposit = GenericUtils.GetDifferenceFromStringAfterSubstraction(availableBalance, amountToWithdrawAndFees);
                Assert.Equal(expectedAvailableBalanceAfterDeposit, GenericUtils.RemoveCommaFromString(availableBalanceAfterDeposit));
                TestProgressLogger.LogCheckPoint(LogMessage.RemainingBalanceVerified);
                expectedHoldBalanceAfterDeposit = GenericUtils.GetSumFromStringAfterAddition(holdBalance, amountToWithdrawAndFees);
                Assert.Equal(expectedHoldBalanceAfterDeposit, holdBalanceAfterDeposit);
                TestProgressLogger.LogCheckPoint(LogMessage.HoldBalanceVerified);

                statusID = walletpage.GetStatusID(driver);
                userFunctions.LogOut();
                TestProgressLogger.LogCheckPoint(String.Format(LogMessage.UserLoggedOutSuccessfully, Const.USER15));

                AdminFunctions adminfunctions = new AdminFunctions(TestProgressLogger);
                adminfunctions.AdminLogIn(TestProgressLogger, Const.ADMIN1);

                AdminCommonFunctions admincommonfunctions = new AdminCommonFunctions(TestProgressLogger);
                admincommonfunctions.SelectTicketsMenu();
                admincommonfunctions.VerifyStatus(driver, statusID, withdrawStatus);
                TestProgressLogger.LogCheckPoint(String.Format(LogMessage.CreatedTicketStatusVerified, statusID));
                admincommonfunctions.UserMenuBtn();
                adminfunctions.AdminLogOut();
                TestProgressLogger.LogCheckPoint(String.Format(LogMessage.AdminUserLogoutSuccessfully, Const.ADMIN1));

                GmailCommonFunctions gmailobj = new GmailCommonFunctions();
                linkUrl = gmailobj.Gmail(driver, emailAddress, gmailPassword, mailSubject);
                driver.Navigate().GoToUrl(linkUrl);
                withdrawSuccess = walletpage.GetWithdrawConfirmedMsg(driver);
                Assert.Equal(LogMessage.WithdrawSuccessfullyConfirmMsg, withdrawSuccess);
                walletpage.ClickOnGoToExchange(driver);
                TestProgressLogger.LogCheckPoint(LogMessage.WithdrawConfirmedMassage);

                adminfunctions.AdminLogIn(TestProgressLogger, Const.ADMIN1);
                admincommonfunctions = new AdminCommonFunctions(TestProgressLogger);
                admincommonfunctions.SelectTicketsMenu();
                admincommonfunctions.VerifyStatus(driver, statusID, ticketStatus);
                TestProgressLogger.LogCheckPoint(LogMessage.VerifiedTicketStatus);
                admincommonfunctions.UserMenuBtn();
                adminfunctions.AdminLogOut();
                TestProgressLogger.LogCheckPoint(String.Format(LogMessage.AdminUserLogoutSuccessfully, Const.ADMIN1));

                userFunctions.LogIn(TestProgressLogger, Const.USER15);
                TestProgressLogger.LogCheckPoint(String.Format(LogMessage.UserLoggedInSuccessfully, Const.USER15));

                UserCommonFunctions.DashBoardMenuButton(driver);
                UserCommonFunctions.NavigateToWallets(driver);
                TestProgressLogger.LogCheckPoint(String.Format(LogMessage.NavigateWalletsPage));

                walletpage.ClickInstrumentDetails(driver, currencyName);
                walletpage.GetHoldAvailablePendingDepositTotalBalanceOnDetailsPage(driver);
                holdBalance  = walletpage.HoldBalanceDetailsPage;
                totalBalance = walletpage.TotalBalanceDetailsPage;

                expectedTotalBalanceAfterDeposit = GenericUtils.GetDifferenceFromStringAfterSubstraction(totalBalanceAfterDeposit, amountToWithdrawAndFees);
                Assert.Equal(expectedTotalBalanceAfterDeposit, GenericUtils.RemoveCommaFromString(totalBalance));
                TestProgressLogger.LogCheckPoint(LogMessage.TotalBalanceVerified);

                expectedHoldBalanceAfterDeposit = GenericUtils.GetDifferenceFromStringAfterSubstraction(holdBalanceAfterDeposit, amountToWithdrawAndFees);
                Assert.Equal(expectedHoldBalanceAfterDeposit, holdBalance);
                TestProgressLogger.LogCheckPoint(LogMessage.HoldBalanceVerified);

                userFunctions.LogOut();
                TestProgressLogger.LogCheckPoint(String.Format(LogMessage.UserLoggedOutSuccessfully, Const.USER15));

                TestProgressLogger.EndTest();
                TestProgressLogger.LogCheckPoint(LogMessage.WalletsWithdrawFiatcurrencyTestPassed);
            }
            catch (Exception e)
            {
                TestProgressLogger.TakeScreenshot();
                TestProgressLogger.Error(LogMessage.WalletsWithdrawFiatcurrencyTestFailed, e);
                throw e;
            }
        }
示例#18
0
        protected override void OnStartup(StartupEventArgs e)
        {
            bool shutDown = false;
            CommandLineParamsType commandLineParams = CoreFunctions.RecognizeCommandLineParams(e);

            if (!CoreFunctions.ApplyCommandLineParameters(commandLineParams))
            {
                return;
            }

            //////////////

            string currentSessionUsername = System.Security.Principal.WindowsIdentity.GetCurrent().Name;
            int    currentSessionId       = 0;
            bool   alreadyExistInCurrent  = false;

            // Get all sessions with username
            List <SessionsFunctions.SessionInfo> sessionInfos   = new SessionsFunctions().ListUsers(Environment.MachineName).Where(z => !String.IsNullOrEmpty(z.DomainName) && !String.IsNullOrEmpty(z.UserName)).ToList();
            List <SessionsFunctions.SessionInfo> sessionWithMmf = new List <SessionsFunctions.SessionInfo>();


            currentSessionId = sessionInfos.Where(z => z.DomainName + "\\" + z.UserName == currentSessionUsername).FirstOrDefault().SessionID;

            // Try to get access to MMF in other Sessions
            foreach (SessionsFunctions.SessionInfo sessionInfo in sessionInfos)
            {
                // Session/
                string name = Functions.MMFFunctions.GetSessionMmfName(sessionInfo.SessionID);

                if (Lib.System.MMFFunctions.Exist(name))
                {
                    sessionWithMmf.Add(sessionInfo);

                    if (currentSessionId == sessionInfo.SessionID)
                    {
                        alreadyExistInCurrent = true;
                    }
                }
            }
//            alreadyExistInCurrent = sessionWithMmf.Where(z => z.SessionID == currentSessionId).Count() > 0;



            ////////////

            if (!alreadyExistInCurrent)
            {
                CreateMMF();

                if (commandLineParams.ForceMode != true)
                {
                    // Just apply
                    if (commandLineParams.RequestedStatus == Status.sOn)
                    {
                        new RegistryFunctions().SetRegKeyValue(AppConsts.KEY_SRP_NODE, AppConsts.KEY_SRP_DEFAULT_LEVEL, AppConsts.SRP_ON, RegistryValueKind.DWord);
                        shutDown = true;
                    }
                    else
                    if (commandLineParams.RequestedStatus == Status.sOff)
                    {
                        new RegistryFunctions().SetRegKeyValue(AppConsts.KEY_SRP_NODE, AppConsts.KEY_SRP_DEFAULT_LEVEL, AppConsts.SRP_OFF, RegistryValueKind.DWord);
                        shutDown = true;
                    }
                }
            }
            else
            {
                if (UserFunctions.IsCurrentUserAdmin())
                {
                    // Exit & -Enable/Disable могу отправить только если есть права Админа

                    byte subCommand = 0;
                    byte param1     = 0;
                    byte param2     = 0;

                    if (commandLineParams.ExitRequest || commandLineParams.MasterInstance)
                    {
                        subCommand = AppData.SUB_COMMAND_EXIT;
                    }

                    if (subCommand != 0)
                    {
                        foreach (SessionsFunctions.SessionInfo session in sessionWithMmf)
                        {
                            // Skip _FOR_ current one
                            if (session.SessionID == currentSessionId && !alreadyExistInCurrent)
                            {
                                continue;
                            }

                            MemoryMappedFile memoryMappedFile = Lib.System.MMFFunctions.Open(Functions.MMFFunctions.GetSessionMmfName(session.SessionID));

                            Functions.MMFFunctions.Write(
                                memoryMappedFile,
                                AppConsts.MEMORY_MANAGED_FILE_LENGTH,
                                AppData.COMMAND,
                                subCommand,
                                param1,
                                param2
                                );

                            memoryMappedFile.Dispose();
                        }
                    }

                    subCommand = 0;
                    param1     = 0;
                    param2     = 0;

                    // Command to itself for change status
                    if (commandLineParams.RequestedStatus == Status.sOn)
                    {
                        subCommand = AppData.SUB_COMMAND_CHANGE;
                        param1     = 0;
                    }
                    else
                    if (commandLineParams.RequestedStatus == Status.sOff)
                    {
                        subCommand = AppData.SUB_COMMAND_CHANGE;
                        param1     = 1;
                    }

                    if (commandLineParams.ForceMode == true)
                    {
                        subCommand = AppData.SUB_COMMAND_CHANGE;
                        param2     = 1;
                    }

                    if (subCommand != 0)
                    {
                        using (MemoryMappedFile memoryMappedFile = Lib.System.MMFFunctions.Open(Functions.MMFFunctions.GetSessionMmfName(currentSessionId)))
                        {
                            Functions.MMFFunctions.Write(
                                memoryMappedFile,
                                AppConsts.MEMORY_MANAGED_FILE_LENGTH,
                                AppData.COMMAND,
                                subCommand,
                                param1,
                                param2
                                );
                        }
                    }
                }

                //

                if (!commandLineParams.MasterInstance)
                {
                    //if (!commandLineParams.ExitRequest && commandLineParams.RequestedStatus == Status.sNotAvailable)
                    //{
                    //    CoreFunctions.OneInstanceCheck(CreateMutex(AppConsts.MUTEX_ID));
                    //}

                    Application.Current.Shutdown();
                    return;
                }
                ////else
                ////{
                ////    commandLineParams.IgnoreMutex = true;
                ////}

                // Because we need to wait some time, when other instance will proceed command in MMF
                Thread.Sleep(500);
            }

            if (shutDown)
            {
                Application.Current.Shutdown();
                return;
            }

            RunMMFMonitor();

            ////mutex = CreateMutex(AppConsts.MUTEX_ID);
            ////if (!commandLineParams.IgnoreMutex)
            ////{
            ////    CoreFunctions.OneInstanceCheck(mutex);
            ////}

            base.OnStartup(e);

            InitTrayIcon();
        }
        public void TC41_WalletsDepositFiatcurrency()
        {
            try
            {
                string ticketStatus;
                string AcceptedticketStatus;
                string amount;
                string availableBalanceAfterDeposit;
                string availableBalanceAfterAccept;
                string totalBalance;
                string pendingBalance;
                string withdrawSuccessMsg;
                string pendingBalanceAfterDeposit;
                string expectedPendingBalanceAfterDeposit;
                string expectedPendingBalanceAfterAccept;
                string ticketID;
                string expectedAvailableBalanceAfterAccept;

                currencyName         = TestData.GetData("USDCurrency");
                comment              = TestData.GetData("TC41_Comment");
                amount               = TestData.GetData("USDAmount");
                fullName             = TestData.GetData("FullName");
                language             = TestData.GetData("TC40_Language");
                bankAddress          = TestData.GetData("TC40_BankAddress");
                bankAccountNumber    = TestData.GetData("TC40_BankAccountNumber");
                bankName             = TestData.GetData("TC40_BankName");
                swiftCode            = TestData.GetData("TC40_SwiftCode");
                withdrawStatus       = TestData.GetData("WithdrawStatus");
                ticketStatus         = TestData.GetData("TicketStatus");
                AcceptedticketStatus = TestData.GetData("AcceptedTicketStatus");

                TestProgressLogger.StartTest();
                UserFunctions userFunctions = new UserFunctions(TestProgressLogger);
                userFunctions.LogIn(TestProgressLogger, Const.USER15);
                TestProgressLogger.LogCheckPoint(String.Format(LogMessage.UserLoggedInSuccessfully, Const.USER15));

                UserCommonFunctions.DashBoardMenuButton(driver);
                UserCommonFunctions.NavigateToWallets(driver);
                TestProgressLogger.LogCheckPoint(String.Format(LogMessage.NavigateWalletsPage));

                WalletPage walletpage = new WalletPage();
                TestProgressLogger.LogCheckPoint(String.Format(LogMessage.StoreCurrentBalance, Const.USER15));
                walletpage.ClickInstrumentDetails(driver, currencyName);
                walletpage.GetHoldAvailablePendingDepositTotalBalanceOnDetailsPage(driver);
                pendingBalance = walletpage.PendingDepositDetailsPage;
                totalBalance   = walletpage.TotalBalanceDetailsPage;
                walletpage.ClickDepositButtonOnDetails(driver);
                walletpage.SendUSDDeposit(driver, fullName, amount, comment);
                walletpage.VerifyUSDDepositOnConfirmationModal(driver, fullName, amount, comment);
                walletpage.ClickOnConfirmUSDModalButton(driver);
                TestProgressLogger.LogCheckPoint(LogMessage.ConfirmationModalVerified);
                withdrawSuccessMsg = UserCommonFunctions.GetTextOfMessage(driver, TestProgressLogger);
                Assert.Equal(LogMessage.USDDepositSuccessMsg, withdrawSuccessMsg);
                ticketID = walletpage.GetDepositUSDTicketID(driver);
                GenericUtils.RefreshPage(driver);
                walletpage.GetHoldAvailablePendingDepositTotalBalanceOnDetailsPage(driver);
                pendingBalanceAfterDeposit         = walletpage.PendingDepositDetailsPage;
                availableBalanceAfterDeposit       = walletpage.AvailableBalanceDetailsPage;
                expectedPendingBalanceAfterDeposit = GenericUtils.GetSumFromStringAfterAddition(pendingBalance, amount);
                Assert.Equal(expectedPendingBalanceAfterDeposit, GenericUtils.RemoveCommaFromString(pendingBalanceAfterDeposit));
                userFunctions.LogOut();
                TestProgressLogger.LogCheckPoint(String.Format(LogMessage.UserLoggedOutSuccessfully, Const.USER15));

                AdminFunctions adminfunctions = new AdminFunctions(TestProgressLogger);
                adminfunctions.AdminLogIn(TestProgressLogger, Const.ADMIN1);

                AdminCommonFunctions admincommonfunctions = new AdminCommonFunctions(TestProgressLogger);
                admincommonfunctions.SelectTicketsMenu();
                admincommonfunctions.NavigateToDepositTicketsTab();
                admincommonfunctions.VerifyStatus(driver, ticketID, ticketStatus);
                TestProgressLogger.LogCheckPoint(LogMessage.VerifiedTicketStatusAsNew);
                admincommonfunctions.DoubleClickOnCreatedDepositTicket(driver, ticketID);
                admincommonfunctions.ClickOnAcceptButtonFromDepositsTicketModal();
                admincommonfunctions.VerifyStatus(driver, ticketID, AcceptedticketStatus);
                TestProgressLogger.LogCheckPoint(LogMessage.VerifiedTicketStatusAsAccepted);
                admincommonfunctions.UserMenuBtn();
                adminfunctions.AdminLogOut();
                TestProgressLogger.LogCheckPoint(String.Format(LogMessage.AdminUserLogoutSuccessfully, Const.ADMIN1));

                userFunctions.LogIn(TestProgressLogger, Const.USER15);
                TestProgressLogger.LogCheckPoint(String.Format(LogMessage.UserLoggedInSuccessfully, Const.USER15));
                UserCommonFunctions.DashBoardMenuButton(driver);
                UserCommonFunctions.NavigateToWallets(driver);
                TestProgressLogger.LogCheckPoint(String.Format(LogMessage.NavigateWalletsPage));
                walletpage.ClickInstrumentDetails(driver, currencyName);
                walletpage.GetHoldAvailablePendingDepositTotalBalanceOnDetailsPage(driver);
                pendingBalance = walletpage.PendingDepositDetailsPage;
                availableBalanceAfterAccept = walletpage.AvailableBalanceDetailsPage;

                expectedPendingBalanceAfterAccept = GenericUtils.GetDifferenceFromStringAfterSubstraction(pendingBalanceAfterDeposit, amount);
                Assert.Equal(expectedPendingBalanceAfterAccept, GenericUtils.RemoveCommaFromString(pendingBalance));
                TestProgressLogger.LogCheckPoint(LogMessage.PendingBalanceVerified);

                expectedAvailableBalanceAfterAccept = GenericUtils.GetSumFromStringAfterAddition(availableBalanceAfterDeposit, amount);
                Assert.Equal(expectedAvailableBalanceAfterAccept, GenericUtils.RemoveCommaFromString(availableBalanceAfterAccept));
                TestProgressLogger.LogCheckPoint(LogMessage.AvailableBalanceVerified);

                userFunctions.LogOut();
                TestProgressLogger.LogCheckPoint(String.Format(LogMessage.UserLoggedOutSuccessfully, Const.USER15));

                TestProgressLogger.EndTest();
                TestProgressLogger.LogCheckPoint(LogMessage.WalletsDepositFiatcurrencyTestPassed);
            }
            catch (Exception e)
            {
                TestProgressLogger.TakeScreenshot();
                TestProgressLogger.Error(LogMessage.WalletsDepositFiatcurrencyTestFailed, e);
                throw e;
            }
        }
示例#20
0
 public void FqdnMinLength()
 {
     Assert.IsTrue(UserFunctions.GetFQDN().Length > 0);
 }
示例#21
0
 public void FqdnCannotStartWithDot()
 {
     Assert.IsFalse(UserFunctions.GetFQDN().StartsWith("."));
 }
示例#22
0
 public void FqdnCannotBeEmpty()
 {
     Assert.AreNotEqual("", UserFunctions.GetFQDN());
 }
示例#23
0
 public void FqdnCannotBeNull()
 {
     Assert.AreNotEqual(null, UserFunctions.GetFQDN());
 }
示例#24
0
 public void UserNameMinLength()
 {
     Assert.IsTrue(UserFunctions.GetUsername().Length > 0);
 }
示例#25
0
 public void UserNameMaxLength()
 {
     Assert.IsTrue(UserFunctions.GetUsername().Length < 16);
 }
示例#26
0
 public void UserNameCannotBeNull()
 {
     Assert.AreNotEqual(null, UserFunctions.GetUsername());
 }
        public override ClaimsPrincipal Authenticate(string resourceName, ClaimsPrincipal incomingPrincipal)
        {
            if (incomingPrincipal != null && incomingPrincipal.Identity.IsAuthenticated == true)
            {
                var logMessage = incomingPrincipal.Identity.Name + " logged in " + DateTime.UtcNow + " <br/>";

                //check if user is an CsiViewer
                var isCsiViewer = AzureGraphAPIFunctions.CheckIfUserIsMemberOfGroup(Settings.CsiViewersRole, incomingPrincipal);

                ((ClaimsIdentity)incomingPrincipal.Identity).AddClaim(new Claim("IsCsiViewer", isCsiViewer.ToString()));

                logMessage += incomingPrincipal.Identity.Name + " isCsiViewer = " + isCsiViewer + " " + DateTime.UtcNow + " <br/>";

                //check if user is an CsiEditor
                var isCsiEditor = AzureGraphAPIFunctions.CheckIfUserIsMemberOfGroup(Settings.CsiEditorsRole, incomingPrincipal);

                ((ClaimsIdentity)incomingPrincipal.Identity).AddClaim(new Claim("IsCsiEditor", isCsiEditor.ToString()));

                logMessage += incomingPrincipal.Identity.Name + " isCsiEditor = " + isCsiEditor + " " + DateTime.UtcNow + " <br/>";

                //check if user is an CsiAdmin
                var isCsiAdmin = AzureGraphAPIFunctions.CheckIfUserIsMemberOfGroup(Settings.CsiAdminsRole, incomingPrincipal);

                ((ClaimsIdentity)incomingPrincipal.Identity).AddClaim(new Claim("IsCsiAdmin", isCsiAdmin.ToString()));

                logMessage += incomingPrincipal.Identity.Name + " isCsiAdmin = " + isCsiAdmin + " " + DateTime.UtcNow + " <br/>";

                //check if user is an DsiViewer
                var isDsiViewer = AzureGraphAPIFunctions.CheckIfUserIsMemberOfGroup(Settings.DsiViewersRole, incomingPrincipal);

                ((ClaimsIdentity)incomingPrincipal.Identity).AddClaim(new Claim("IsDsiViewer", isDsiViewer.ToString()));

                logMessage += incomingPrincipal.Identity.Name + " isDsiViewer = " + isDsiViewer + " " + DateTime.UtcNow + " <br/>";

                //check if user is an DsiEditor
                var isDsiEditor = AzureGraphAPIFunctions.CheckIfUserIsMemberOfGroup(Settings.DsiEditorsRole, incomingPrincipal);

                ((ClaimsIdentity)incomingPrincipal.Identity).AddClaim(new Claim("IsDsiEditor", isDsiEditor.ToString()));

                logMessage += incomingPrincipal.Identity.Name + " isDsiEditor = " + isDsiEditor + " " + DateTime.UtcNow + " <br/>";

                //check if user is an DsiAdmin
                var isDsiAdmin = AzureGraphAPIFunctions.CheckIfUserIsMemberOfGroup(Settings.DsiAdminsRole, incomingPrincipal);

                ((ClaimsIdentity)incomingPrincipal.Identity).AddClaim(new Claim("IsDsiAdmin", isDsiAdmin.ToString()));

                logMessage += incomingPrincipal.Identity.Name + " isDsiAdmin = " + isDsiAdmin + " " + DateTime.UtcNow + " <br/>";



                //check if user is an DsnViewer
                var isDsnViewer = AzureGraphAPIFunctions.CheckIfUserIsMemberOfGroup(Settings.DsnViewersRole, incomingPrincipal);

                ((ClaimsIdentity)incomingPrincipal.Identity).AddClaim(new Claim("IsDsnViewer", isDsnViewer.ToString()));

                logMessage += incomingPrincipal.Identity.Name + " isDsnViewer = " + isDsnViewer + " " + DateTime.UtcNow + " <br/>";

                //check if user is an DsnEditor
                var isDsnEditor = AzureGraphAPIFunctions.CheckIfUserIsMemberOfGroup(Settings.DsnEditorsRole, incomingPrincipal);

                ((ClaimsIdentity)incomingPrincipal.Identity).AddClaim(new Claim("IsDsnEditor", isDsnEditor.ToString()));

                logMessage += incomingPrincipal.Identity.Name + " isDsnEditor = " + isDsnEditor + " " + DateTime.UtcNow + " <br/>";

                //check if user is an DsnAdmin
                var isDsnAdmin = AzureGraphAPIFunctions.CheckIfUserIsMemberOfGroup(Settings.DsnAdminsRole, incomingPrincipal);

                ((ClaimsIdentity)incomingPrincipal.Identity).AddClaim(new Claim("IsDsnAdmin", isDsnAdmin.ToString()));

                logMessage += incomingPrincipal.Identity.Name + " isDsnAdmin = " + isDsnAdmin + " " + DateTime.UtcNow + " <br/>";

                Logger.LogEvent("Workorders - " + LogLevel.Info.ToString(), logMessage + DateTime.UtcNow);

                if (UserFunctions.IsAllowedAccessToCompany(isCsiViewer,
                                                           isCsiEditor,
                                                           isCsiAdmin,
                                                           isDsiViewer,
                                                           isDsiEditor,
                                                           isDsiAdmin,
                                                           isDsnViewer,
                                                           isDsnEditor,
                                                           isDsnAdmin
                                                           ) == false)
                {
                    CompanyCookie.SelectedCompany = null;
                }
            }

            return(incomingPrincipal);
        }
        public void TC6_VerifySellLimitOrder()
        {
            try
            {
                string type;
                string buyOrderFeeValue;
                string sellOrderFeeValue;
                instrument      = TestData.GetData("Instrument");
                orderType       = TestData.GetData("OrderType");
                menuTab         = TestData.GetData("MenuTab");
                buyTab          = TestData.GetData("BuyTab");
                sellTab         = TestData.GetData("SellTab");
                buyOrderSize    = TestData.GetData("TC6_BuyOrderSize");
                sellOrderSize   = TestData.GetData("TC6_SellOrderSize");
                incBuyOrderSize = TestData.GetData("TC6_IncreasedBuyOrderSize");
                decBuyOrderSize = TestData.GetData("TC6_DecreasedBuyOrderSize");
                limitPrice      = TestData.GetData("TC6_LimitPrice");
                timeInForce     = TestData.GetData("TC6_TimeInForce");
                feeComponent    = TestData.GetData("FeeComponent");

                type              = Const.Limit;
                buyOrderFeeValue  = GenericUtils.FeeAmount(buyOrderSize, feeComponent);
                sellOrderFeeValue = GenericUtils.SellFeeAmount(sellOrderSize, limitPrice, feeComponent);

                TestProgressLogger.StartTest();
                UserFunctions       userFunctions      = new UserFunctions(TestProgressLogger);
                UserCommonFunctions userCommonFunction = new UserCommonFunctions(TestProgressLogger);
                OrderEntryPage      orderEntryPage     = new OrderEntryPage(driver, TestProgressLogger);
                VerifyOrdersTab     objVerifyOrdersTab = new VerifyOrdersTab(driver, TestProgressLogger);

                // Creating Buy and Sell Order to get the last price
                userCommonFunction.PlaceOrdersToSetLastPrice(driver, instrument, buyTab, sellTab, buyOrderSize, limitPrice, timeInForce, Const.USER10, Const.USER11);

                // Scenario 1: Buy order B1 with same price is available and B1 quantity is = S1.
                userFunctions.LogIn(TestProgressLogger, Const.USER8);

                Dictionary <string, string> placeLimitSellOrder = orderEntryPage.PlaceLimitSellOrder(instrument, sellTab, sellOrderSize, limitPrice, timeInForce);
                Assert.True(objVerifyOrdersTab.VerifyOpenOrdersTab(instrument, sellTab, type, Double.Parse(sellOrderSize), limitPrice, placeLimitSellOrder["PlaceOrderTime"], placeLimitSellOrder["PlaceOrderTimePlusOneMin"]));
                TestProgressLogger.LogCheckPoint(string.Format(LogMessage.LimitOrderSuccessMsg, sellTab, sellOrderSize, limitPrice));

                userFunctions.LogIn(TestProgressLogger, Const.USER9);
                Dictionary <string, string> placeLimitBuyOrder = orderEntryPage.PlaceLimitBuyOrder(instrument, buyTab, buyOrderSize, limitPrice, timeInForce);
                Assert.True(objVerifyOrdersTab.VerifyFilledOrdersTab(instrument, buyTab, Double.Parse(buyOrderSize), buyOrderFeeValue, placeLimitBuyOrder["PlaceOrderTime"], placeLimitBuyOrder["PlaceOrderTimePlusOneMin"]));
                TestProgressLogger.LogCheckPoint(string.Format(LogMessage.LimitOrderSuccessMsg, buyTab, buyOrderSize, limitPrice));

                userFunctions.LogIn(TestProgressLogger, Const.USER8);
                orderEntryPage.NavigateToHomePage(instrument);
                Assert.True(objVerifyOrdersTab.VerifyFilledOrdersTab(instrument, sellTab, Double.Parse(sellOrderSize), sellOrderFeeValue, placeLimitSellOrder["PlaceOrderTime"], placeLimitSellOrder["PlaceOrderTimePlusOneMin"]));

                // Scenario 2: Buy order B1 with same price is available and B1 quantity is > S1.
                userFunctions.LogIn(TestProgressLogger, Const.USER8);
                Dictionary <string, string> placeLimitSellOrderS2 = orderEntryPage.PlaceLimitSellOrder(instrument, sellTab, sellOrderSize, limitPrice, timeInForce);
                Assert.True(objVerifyOrdersTab.VerifyOpenOrdersTab(instrument, sellTab, type, Double.Parse(sellOrderSize), limitPrice, placeLimitSellOrderS2["PlaceOrderTime"], placeLimitSellOrderS2["PlaceOrderTimePlusOneMin"]));
                TestProgressLogger.LogCheckPoint(string.Format(LogMessage.LimitOrderSuccessMsg, sellTab, sellOrderSize, limitPrice));

                userFunctions.LogIn(TestProgressLogger, Const.USER9);
                Dictionary <string, string> placeLimitBuyOrderS2 = orderEntryPage.PlaceLimitBuyOrder(instrument, buyTab, incBuyOrderSize, limitPrice, timeInForce);
                Assert.True(objVerifyOrdersTab.VerifyFilledOrdersTab(instrument, buyTab, Double.Parse(sellOrderSize), buyOrderFeeValue, placeLimitSellOrderS2["PlaceOrderTime"], placeLimitSellOrderS2["PlaceOrderTimePlusOneMin"]));
                TestProgressLogger.LogCheckPoint(string.Format(LogMessage.LimitOrderSuccessMsg, buyTab, incBuyOrderSize, limitPrice));

                userFunctions.LogIn(TestProgressLogger, Const.USER8);
                orderEntryPage.NavigateToHomePage(instrument);
                Assert.True(objVerifyOrdersTab.VerifyFilledOrdersTab(instrument, sellTab, Double.Parse(sellOrderSize), sellOrderFeeValue, placeLimitSellOrderS2["PlaceOrderTime"], placeLimitSellOrderS2["PlaceOrderTimePlusOneMin"]));


                // Scenario 3: Buy order B1 with same price is available and B1 quantity is < S1.
                UserCommonFunctions.LoginAndCancelAllOrders(TestProgressLogger, driver, instrument, Const.USER9);
                userFunctions.LogIn(TestProgressLogger, Const.USER8);
                Dictionary <string, string> placeLimitSellOrderS3 = orderEntryPage.PlaceLimitSellOrder(instrument, sellTab, sellOrderSize, limitPrice, timeInForce);
                Assert.True(objVerifyOrdersTab.VerifyOpenOrdersTab(instrument, sellTab, type, Double.Parse(sellOrderSize), limitPrice, placeLimitSellOrderS3["PlaceOrderTime"], placeLimitSellOrderS3["PlaceOrderTimePlusOneMin"]));
                TestProgressLogger.LogCheckPoint(string.Format(LogMessage.LimitOrderSuccessMsg, sellTab, sellOrderSize, limitPrice));

                userFunctions.LogIn(TestProgressLogger, Const.USER9);
                buyOrderFeeValue = GenericUtils.FeeAmount(decBuyOrderSize, feeComponent);
                Dictionary <string, string> placeLimitBuyOrderS3 = orderEntryPage.PlaceLimitBuyOrder(instrument, buyTab, decBuyOrderSize, limitPrice, timeInForce);
                Assert.True(objVerifyOrdersTab.VerifyFilledOrdersTab(instrument, buyTab, Double.Parse(decBuyOrderSize), buyOrderFeeValue, placeLimitSellOrderS3["PlaceOrderTime"], placeLimitSellOrderS3["PlaceOrderTimePlusOneMin"]));
                TestProgressLogger.LogCheckPoint(string.Format(LogMessage.LimitOrderSuccessMsg, buyTab, decBuyOrderSize, limitPrice));

                userFunctions.LogIn(TestProgressLogger, Const.USER8);
                orderEntryPage.NavigateToHomePage(instrument);
                sellOrderFeeValue = GenericUtils.SellFeeAmount(decBuyOrderSize, limitPrice, feeComponent);
                string orderSizeDifference = GenericUtils.GetDifferenceFromStringAfterSubstraction(sellOrderSize, decBuyOrderSize);
                Assert.True(objVerifyOrdersTab.VerifyOpenOrdersTab(instrument, sellTab, type, Double.Parse(orderSizeDifference), limitPrice, placeLimitSellOrderS3["PlaceOrderTime"], placeLimitSellOrderS3["PlaceOrderTimePlusOneMin"]));
                Assert.True(objVerifyOrdersTab.VerifyFilledOrdersTab(instrument, sellTab, Double.Parse(decBuyOrderSize), sellOrderFeeValue, placeLimitSellOrderS3["PlaceOrderTime"], placeLimitSellOrderS3["PlaceOrderTimePlusOneMin"]));

                // This step cancels the remaining order and verifies the same in Open orders tab
                UserCommonFunctions.CancelOrderBookSellOrder(driver);
                Assert.False(objVerifyOrdersTab.VerifyOpenOrdersTab(instrument, sellTab, type, Double.Parse(orderSizeDifference), limitPrice, placeLimitSellOrderS3["PlaceOrderTime"], placeLimitSellOrderS3["PlaceOrderTimePlusOneMin"]));
            }
            catch (NoSuchElementException ex)
            {
                TestProgressLogger.LogCheckPoint(ex.Message + ex.StackTrace);
                throw ex;
            }
            catch (Exception e)
            {
                TestProgressLogger.TakeScreenshot();
                TestProgressLogger.Error(LogMessage.MarketOrderTestFailed, e);
                throw e;
            }
            finally
            {
                TestProgressLogger.EndTest();
            }
        }
        public void TC1_VerifyDetailsOnLandingPageTest()
        {
            instrument             = TestData.GetData("Instrument");
            menuTab                = TestData.GetData("MenuTab");
            buyTab                 = TestData.GetData("BuyTab");
            sellTab                = TestData.GetData("SellTab");
            orderBook              = TestData.GetData("OrderBookValue");
            openOrders             = TestData.GetData("OpenOrdersValue");
            filledOrders           = TestData.GetData("FilledOrdersValue");
            InactiveOrders         = TestData.GetData("InactiveOrdersValue");
            tradeReports           = TestData.GetData("TradeReportsValue");
            depositStatus          = TestData.GetData("DepositStatusValue");
            withdrawStatus         = TestData.GetData("WithdrawStatusValue");
            pairValue              = TestData.GetData("TC1_PairValue");
            sideValue              = TestData.GetData("TC1_SideValue");
            typeValue              = TestData.GetData("TC1_TypeValue");
            sizeValue              = TestData.GetData("TC1_SizeValue");
            priceValue             = TestData.GetData("TC1_PriceValue");
            dateTimeValue          = TestData.GetData("TC1_DateTimeValue");
            statusValue            = TestData.GetData("TC1_StatusValue");
            actionValue            = TestData.GetData("TC1_ActionValue");
            actionsValue           = TestData.GetData("TC1_ActionsValue");
            idValue                = TestData.GetData("TC1_IDValue");
            totalValue             = TestData.GetData("TC1_TotalValue");
            feeValue               = TestData.GetData("TC1_FeeValue");
            executionValue         = TestData.GetData("TC1_ExecutionIDValue");
            productValue           = TestData.GetData("TC1_ProductValue");
            amountValue            = TestData.GetData("TC1_AmountValue");
            createdValue           = TestData.GetData("TC1_CreatedValue");
            priceChartValue        = TestData.GetData("TC1_PriceChartValue");
            availableBalanceValue  = TestData.GetData("TC1_AvailableBalanceValue");
            holdValue              = TestData.GetData("TC1_HoldValue");
            pendingDepositsValue   = TestData.GetData("TC1_PendingDepositsValue");
            totalBalanceValue      = TestData.GetData("TC1_TotalBalanceValue");
            recentTradesPriceValue = TestData.GetData("TC1_RecentTradesPriceValue");
            recentTradesQtyValue   = TestData.GetData("TC1_RecentTradesQtyValue");
            recentTradesTimeValue  = TestData.GetData("TC1_RecentTradesTimeValue");
            orderBookPriceValue    = TestData.GetData("TC1_OrderBookPriceValue");
            orderBookQtyValue      = TestData.GetData("TC1_OrderBookQtyValue");
            orderBookMySizeValue   = TestData.GetData("TC1_OrderBookMySizeValue");

            OrderEntryMarketValue = TestData.GetData("TC1_OrderEntryMarketValue");
            OrderEntryLimitValue  = TestData.GetData("TC1_OrderEntryLimitValue");
            OrderEntryStopValue   = TestData.GetData("TC1_OrderEntryStopValue");

            DetailsOnLandingPage objDetailsOnLandingPage = new DetailsOnLandingPage(TestProgressLogger);

            try
            {
                TestProgressLogger.StartTest();
                UserFunctions userFunctions = new UserFunctions(TestProgressLogger);
                userFunctions.LogIn(TestProgressLogger, Const.USER14);
                UserCommonFunctions.DashBoardMenuButton(driver);
                UserCommonFunctions.SelectAnExchange(driver);
                Assert.True(objDetailsOnLandingPage.ExchangeLinkButton());
                UserCommonFunctions.SelectInstrumentFromExchange(instrument, driver);
                Assert.True(objDetailsOnLandingPage.VerifyOpenOrdersTab(openOrders, pairValue, sideValue, typeValue, sizeValue, priceValue, dateTimeValue, statusValue, actionValue));
                Assert.True(objDetailsOnLandingPage.VerifyFilledOrdersTab(filledOrders, idValue, pairValue, sideValue, sizeValue, priceValue, totalValue, feeValue, executionValue, dateTimeValue));
                Assert.True(objDetailsOnLandingPage.VerifyInactiveOrdersTab(filledOrders, pairValue, sideValue, typeValue, sizeValue, priceValue, dateTimeValue, statusValue));
                Assert.True(objDetailsOnLandingPage.VerifyTradeReportTab(tradeReports, pairValue, sideValue, sizeValue, priceValue, feeValue, dateTimeValue, statusValue));
                Assert.True(objDetailsOnLandingPage.VerifyDepositStatusTab(depositStatus, productValue, amountValue, statusValue, createdValue, feeValue));
                Assert.True(objDetailsOnLandingPage.VerifyWithdrawStatusTab(withdrawStatus, productValue, amountValue, statusValue, createdValue, feeValue, actionsValue));
                Assert.True(objDetailsOnLandingPage.PriceChartTxt(priceChartValue));
                Assert.True(objDetailsOnLandingPage.OrderEntryWithBuyOption());
                Assert.True(objDetailsOnLandingPage.OrderEntryWithSellOption());
                objDetailsOnLandingPage.balancesBtn();
                Assert.True(objDetailsOnLandingPage.AvailableBalanceTxt(availableBalanceValue));
                Assert.True(objDetailsOnLandingPage.HoldTxt(holdValue));
                Assert.True(objDetailsOnLandingPage.PendingDepositsTxt(pendingDepositsValue));
                Assert.True(objDetailsOnLandingPage.TotalBalanceTxt(totalBalanceValue));
                Assert.True(objDetailsOnLandingPage.verifyOrderBookMenuTab(orderBookPriceValue, orderBookQtyValue, orderBookMySizeValue));
                Assert.True(objDetailsOnLandingPage.verifyRecentTradesMenuTab(recentTradesPriceValue, recentTradesQtyValue, recentTradesTimeValue));
                objDetailsOnLandingPage.OrderEntryBtn();
                Thread.Sleep(2000);
                Assert.True(objDetailsOnLandingPage.VerifyBuyOrderEntryMenuAndSubMenuTab(buyTab, OrderEntryMarketValue, OrderEntryLimitValue, OrderEntryStopValue));
                Assert.True(objDetailsOnLandingPage.VerifySellOrderEntryMenuAndSubMenuTab(sellTab, OrderEntryMarketValue, OrderEntryLimitValue, OrderEntryStopValue));
                Assert.True(objDetailsOnLandingPage.CancelBtn());
                Assert.True(objDetailsOnLandingPage.AdvanceOrderBtn());
                Assert.True(objDetailsOnLandingPage.OrderEntryButn());
                Assert.True(objDetailsOnLandingPage.balancesButn());
                Assert.True(objDetailsOnLandingPage.VariouOptionInPriceChart());

                Thread.Sleep(3000);
            }
            catch (NoSuchElementException ex)
            {
                TestProgressLogger.LogCheckPoint(ex.Message + ex.StackTrace);
            }
            catch (Exception e)
            {
                TestProgressLogger.TakeScreenshot();
                TestProgressLogger.Error(String.Format(LogMessage.VerifiedDetailInLandingPageFailed));
                throw e;
            }
            finally
            {
                TestProgressLogger.EndTest();
                UserFunctions userFunctionality = new UserFunctions(TestProgressLogger);
                userFunctionality.LogOut();
            }
        }
示例#30
0
 public void UserNameCannotBeEmpty()
 {
     Assert.AreNotEqual("", UserFunctions.GetUsername());
 }