示例#1
0
        public void CalculateBtnEnabled(int amount, int rate, int term)
        {
            DepositPage depositPage = new DepositPage(driver);

            depositPage.SetAmount(amount);
            depositPage.SetRate(rate);
            depositPage.SetTerm(term);

            Assert.IsTrue(depositPage.CalculateBtn.Enabled);
        }
示例#2
0
        public void Income_And_Interest(int fin_year)
        {
            //Arrange
            Decimal[] amount_array = { 1m, 100.54m, 100000m };
            Decimal[] rate_array   = { 1m, 13.5m, 100m };
            Decimal[] term_array   = { 1m, 7.7m, 360m };

            //Act
            int n           = 0;
            int year_length = 360;

            Decimal exp_interest;
            Decimal exp_income;

            Decimal act_interest;
            Decimal act_income;

            int array_size = amount_array.Length * rate_array.Length * term_array.Length;

            Decimal[] exp_interest_array = new Decimal[array_size];
            Decimal[] exp_income_array   = new Decimal[array_size];

            Decimal[] act_interest_array = new Decimal[array_size];
            Decimal[] act_income_array   = new Decimal[array_size];

            //Act
            DepositPage depositPage = new DepositPage(driver);

            depositPage.SelectFinYear(fin_year);

            if (fin_year == 365)
            {
                year_length = 365;
                term_array[term_array.Length - 1] = 365;
            }

            for (int i = 0; i < amount_array.Length; i++)
            {
                depositPage.SetAmount(amount_array[i]);
                for (int j = 0; j < rate_array.Length; j++)
                {
                    depositPage.SetRate(rate_array[j]);
                    for (int k = 0; k < term_array.Length; k++)
                    {
                        depositPage.SetTerm(term_array[k]);

                        exp_interest = Math.Round(amount_array[i] * rate_array[j] * term_array[k] / 100 / year_length, 2);
                        exp_income   = amount_array[i] + exp_interest;

                        depositPage.Calculate();

                        exp_interest_array[n] = exp_interest;
                        exp_income_array[n]   = exp_income;

                        act_interest = depositPage.InterestDec;
                        act_income   = depositPage.IncomeDec;

                        act_interest_array[n] = act_interest;
                        act_income_array[n]   = act_income;

                        if (exp_interest != act_interest || exp_income != act_income)
                        {
                            Console.WriteLine($"n={ n }; amount={amount_array[i]}; rate={rate_array[j]}; term={term_array[k]};");
                            Console.WriteLine($"exp_interest={exp_interest}; act_interest={act_interest}; exp_income={exp_income}; act_income={act_income}");
                        }

                        n++;
                    }
                }
            }

            //Assert
            Assert.AreEqual(exp_interest_array, act_interest_array);
            Assert.AreEqual(exp_income_array, act_income_array);
        }