Пример #1
0
 public static AppValue GetAppValues(string curUser)
 {
     if (objParams == null)
     {
         objParams = new AppValue(curUser);
         return(objParams);
     }
     else
     {
         return(objParams);
     }
 }
Пример #2
0
        public void CodedUITestMethod1()
        {
            Log.Write("Test Case:" + testIteration);
            Log.Write("-----------------------------------------------------------");
            Log.Write("\n");
            // To generate code for this test, select "Generate Code for Coded UI Test" from the shortcut menu and select one of the menu items.
            // For more information on generated code, see http://go.microsoft.com/fwlink/?LinkId=179463

            // LaunchCES(),SelectPset() method should be onlu callled once during execution of test

            try
            {
                string user = null;
                if (CodedUITest1.testIteration == 1)
                {
                    //this.UIMap.LogintoTM();
                    //this.UIMap.LaunchCES();
                    //Playback.Wait(10000);


                    // this.UIMap.SelectPset();
                }

                string operation = TestContext.DataRow["Operation"].ToString();
                //string abmId = TestContext.DataRow["ABMID"].ToString();
                string sequence      = TestContext.DataRow["Sequence"].ToString();
                string CurrencyDenom = TestContext.DataRow["CurrencyDenom"].ToString();



                if (operation.Equals("Fill ATM"))
                {
                    try
                    {
                        Log.Write("Operation Open ATM");
                        Log.Write("-----------------------------------------------------------");
                        Log.Write("\n");
                        System.Text.StringBuilder Buffer = new System.Text.StringBuilder(64);
                        int nSize = 64;
                        GetUserName(Buffer, ref nSize);
                        user = Buffer.ToString();

                        if (!(user.Equals("")))
                        {
                            val = AppValue.GetAppValues(user);
                        }
                        this.UIMap.EnterABMIdParams.UIItemEditText = (val.abmId.GetValue(i)).ToString();
                        this.UIMap.EnterABMId();
                        i++;
                        Log.Write("Operation Open ATM Successful");
                        Log.Write("-----------------------------------------------------------");
                        Log.Write("\n");
                    }
                    catch (Exception)
                    {
                        Log.Write("Operation Open ATM Failed");
                        Log.Write("-----------------------------------------------------------");
                        Log.Write("\n");
                    }
                }
                // setting the sequence number of the envelope

                else if (sequence.Length > 0)
                {
                    this.UIMap.TypeSeqNumberParams.UIItemEditText = sequence;
                    this.UIMap.TypeSeqNumber();
                    try
                    {
                        string[] currencyValues = CurrencyDenom.Split(';');
                        foreach (string currencyValue in currencyValues)
                        {
                            string currency    = currencyValue.Substring(0, 3);
                            string denomValues = currencyValue.Substring(4, (currencyValue.Length - 4));

                            if (currency.Equals("CAD"))
                            {
                                Log.Write("CAD Currency");
                                Log.Write("-----------------------------------------------------------");
                                Log.Write("\n");
                                string[] CADdenomValue = denomValues.Split(',');
                                foreach (string denom in CADdenomValue)
                                {
                                    string[] denomCount = denom.Split('=');
                                    if (denomCount.GetValue(0).Equals("5"))
                                    {
                                        UIMap.PutCADParams.UIItemEditText = denomCount.GetValue(1).ToString();
                                    }
                                    else if (denomCount.GetValue(0).Equals("10"))
                                    {
                                        UIMap.PutCADParams.UIItemEditText1 = denomCount.GetValue(1).ToString();
                                    }
                                    else if (denomCount.GetValue(0).Equals("20"))
                                    {
                                        UIMap.PutCADParams.UIItemEditText2 = denomCount.GetValue(1).ToString();
                                    }
                                    else if (denomCount.GetValue(0).Equals("50"))
                                    {
                                        UIMap.PutCADParams.UIItemEditText3 = denomCount.GetValue(1).ToString();
                                    }
                                    else if (denomCount.GetValue(0).Equals("100"))
                                    {
                                        UIMap.PutCADParams.UIItemEditText4 = denomCount.GetValue(1).ToString();
                                    }

                                    else
                                    {
                                    }
                                }
                                //this.UIMap.SeqandDenonCAD();
                                this.UIMap.PutCAD();
                                Log.Write("Test Case:" + testIteration + "succeed");
                                Log.Write("-----------------------------------------------------------");
                                Log.Write("\n");
                            }
                            else if (currency.Equals("USD"))
                            {
                                Log.Write("USD Currency");
                                Log.Write("-----------------------------------------------------------");
                                Log.Write("\n");
                                string[] USDdenomValue = denomValues.Split(',');
                                foreach (string denom in USDdenomValue)
                                {
                                    string[] denomCount = denom.Split('=');

                                    if (denomCount.GetValue(0).Equals("1"))
                                    {
                                        UIMap.PutUSDParams.UIItemEditText = denomCount.GetValue(1).ToString();
                                    }
                                    else if (denomCount.GetValue(0).Equals("2"))
                                    {
                                        UIMap.PutUSDParams.UIItemEditText1 = denomCount.GetValue(1).ToString();
                                    }
                                    else if (denomCount.GetValue(0).Equals("5"))
                                    {
                                        UIMap.PutUSDParams.UIItemEditText2 = denomCount.GetValue(1).ToString();
                                    }
                                    else if (denomCount.GetValue(0).Equals("10"))
                                    {
                                        UIMap.PutUSDParams.UIItemEditText3 = denomCount.GetValue(1).ToString();
                                    }

                                    else
                                    {
                                    }
                                }
                                this.UIMap.PutUSD();
                                Log.Write("Test Case:" + testIteration + "succeed");
                                Log.Write("-----------------------------------------------------------");
                                Log.Write("\n");
                            }
                        }
                    }
                    catch (Exception)
                    {
                        Log.Write("Test Case:" + testIteration + "Failed");
                        Log.Write("-----------------------------------------------------------");
                        Log.Write("\n");
                    }

                    /**
                     * The logic below is used to get the Currency ,
                     * denomination and values for the corresponding denoms.
                     * According to the values parsed , values will be set to textboxes
                     ** /
                     */



                    // Playback.Wait(1000);

                    try
                    {
                        System.Threading.Thread.Sleep(500);
                        this.UIMap.CloseEnv();
                        Log.Write("Envelope Closed");
                        Log.Write("-----------------------------------------------------------");
                        Log.Write("\n");
                        try
                        {
                            if (operation.Equals("Truncate"))
                            {
                                Log.Write("Envelope Truncated");
                                Log.Write("-----------------------------------------------------------");
                                Log.Write("\n");
                                System.Threading.Thread.Sleep(500);
                                this.UIMap.Truncate();
                            }
                        }
                        catch (Exception)
                        {
                            Log.Write("Envelope Not Truncated");
                            Log.Write("-----------------------------------------------------------");
                            Log.Write("\n");
                        }
                    }
                    catch (Exception)
                    {
                        Log.Write("Envelope Not Closed");
                        Log.Write("-----------------------------------------------------------");
                        Log.Write("\n");
                    }
                }
                else if (operation.Equals("Complete ATM"))
                {
                    Log.Write("ATM Completed");
                    Log.Write("-----------------------------------------------------------");
                    Log.Write("\n");
                    System.Threading.Thread.Sleep(500);
                    this.UIMap.CompleteATM();
                }



                //this.UIMap.PutGBP();
                // this.UIMap.PutEURCorr();

                //this.UIMap.PutCADCntrft();
                //this.UIMap.CloseCADCntrftEnv();
                // Passing values for denomination
                //this.UIMap.SeeifthisworksParams.UIItemEditText = denomVal1;
                //this.UIMap.SeeifthisworksParams.UIItemEditText1 = denomVal2;

                //this.UIMap.Seeifthisworks();
                //this.UIMap.EnterfirstDenom();
                //this.UIMap.EnterSecondDenom();

                //this.UIMap.CheckMouse();



                //Logger.Log.CloseFile();

                //this.UIMap.LogOutCES();

                //this.UIMap.GiveValueandClose();

                //this.UIMap.TestDataFeeded2(); //This function works because of mouse click on the grid !
                //this.UIMap.TestDataFeeded();

                //Increment the testIteration by one for every iteration
                // testIteration++;
            }
            catch (Exception)
            {
                throw;
            }
        }