public void Days_per_Month(int year) { //Arrange int[] exp_days_number = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };; if (year % 4 == 0) { exp_days_number[1] = 29; } //Act DepositPage depositPage = new DepositPage(driver); depositPage.SelectStartYear.SelectByText(year.ToString()); IList <IWebElement> months_list = depositPage.SelectStartMonth.Options; int i = 0; int[] act_days_number = new int[12]; foreach (IWebElement el in months_list) { el.Click(); act_days_number[i] = depositPage.SelectStartDay.Options.Count; i++; } //Assert Assert.AreEqual(exp_days_number, act_days_number); }
public void CalculateBtnDisabled365(int amount, int rate, int term) { DepositPage depositPage = new DepositPage(driver); depositPage.SetAmountRateTerm(amount, rate, term); Assert.IsFalse(depositPage.CalculateBtn.Enabled); }
public void Financial_Year_365_Selected_byDefault() { //Act DepositPage depositPage = new DepositPage(driver); //Assert Assert.AreEqual("true", depositPage.FinYear365.GetAttribute("checked")); Assert.IsNull(depositPage.FinYear360.GetAttribute("checked")); }
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); }
public void Financial_Year_IsClicked_365() { //Act DepositPage depositPage = new DepositPage(driver); depositPage.FinYear365.Click(); //Assert Assert.AreEqual("true", depositPage.FinYear365.GetAttribute("checked")); }
public void LastCalculatedDataSaved() { //Act DepositPage depositPage = new DepositPage(driver); depositPage.SetAmountRateTerm(12345, 87, 299); depositPage.SelectFinYear(360); depositPage.Calculate(); //Assert Assert.AreEqual(depositPage.CaptureDataToArray(), depositPage.OpenHistoryPage().CaptureRowToArray(1)); }
public void HistoryNotRestored() { //Act DepositPage depositPage = new DepositPage(driver); depositPage.SetAmountRateTerm(12345, 87, 299); depositPage.SelectFinYear(360); depositPage.Calculate(); //Assert Assert.IsTrue(depositPage.OpenHistoryPage().Clear().BackToDeposit().OpenHistoryPage().IsHistoryClean); }
// Client (test) manipulates objects in the composition through the component interface (ILoadableComponent) static void Main(string[] args) { IWebDriver driver = new FirefoxDriver(); driver.Manage().Window.Maximize(); // Leaf object ILoadableComponent depositPage = new DepositPage(driver); depositPage.Load(); //driver.Quit(); }
public void SequentialCalculationsSaved(int amount_of_calculations) { //Act DepositPage depositPage = new DepositPage(driver); depositPage.OpenHistoryPage().Clear().BackToDeposit(); for (int i = 0; i < amount_of_calculations; i++) { depositPage.SetAmountRateTerm(12341 + i, 91 + i, 301 + i); depositPage.Calculate(); } //Assert Assert.AreEqual(amount_of_calculations, depositPage.OpenHistoryPage().GetRowsNumber()); }
public void End_Date(int term, int fin_year) { //Arrange DateTime startDate = new DateTime(2019, 7, 15); //Act DepositPage depositPage = new DepositPage(driver); depositPage.StartDate = startDate; depositPage.SelectFinYear(fin_year); depositPage.SetAmountRateTerm(1, 1, term); depositPage.Calculate(); //Assert Assert.AreEqual(startDate.AddDays(term).ToString(SettingsPage.DefaultDateFormat, CultureInfo.InvariantCulture), depositPage.EndDate); }
public UserCenter_InitClasses(IWebDriver driver) { accountStatementPage = new AccountStatementPage(); bonusesPage = new BonusesPage(); depositPage = new DepositPage(); myBetsPage = new MyBetsPage(); editProfilePage = new EditProfilePage(); withdrawPage = new WithdrawPage(); PageFactory.InitElements(driver, this); PageFactory.InitElements(driver, accountStatementPage); PageFactory.InitElements(driver, bonusesPage); PageFactory.InitElements(driver, depositPage); PageFactory.InitElements(driver, myBetsPage); PageFactory.InitElements(driver, editProfilePage); PageFactory.InitElements(driver, withdrawPage); }
public void OrderingInHistory(int amount_of_calculations) { //Act String[] entered_values = new string[8]; DepositPage depositPage = new DepositPage(driver); for (int i = 0; i < amount_of_calculations; i++) { depositPage.SetAmountRateTerm(12341 + i, 91 + i, 301 + i); depositPage.Calculate(); if (i == 0) { entered_values = depositPage.CaptureDataToArray(); } } //Assert Assert.AreEqual(entered_values, depositPage.OpenHistoryPage().CaptureRowToArray(amount_of_calculations)); }
public void Months_Order() { //Arrange string[] exp_month_names = { "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" }; //Act DepositPage depositPage = new DepositPage(driver); int i = 0; string[] act_months_names = new string[exp_month_names.Length]; foreach (IWebElement el in depositPage.SelectStartMonth.Options) { act_months_names[i] = el.Text; i++; } //Assert Assert.AreEqual(exp_month_names, act_months_names); }
public void Date_Format_Applied(String date_format, int term) { //Arrange DateTime startDate = new DateTime(2020, 1, 1); //Act SettingsPage settingsPage = new SettingsPage(driver); settingsPage.SelectDateFormat.SelectByText(date_format); settingsPage.Save(); DepositPage depositPage = new DepositPage(driver); depositPage.StartDate = startDate; depositPage.SetAmountRateTerm(1, 1, term); depositPage.Calculate(); //Assert Assert.AreEqual(startDate.AddDays(term).ToString(date_format, CultureInfo.InvariantCulture), depositPage.EndDate); }
public void Number_Format_Applied(String number_format, int fin_year) { //Arrange Decimal amount = 12345m; int rate = 74; int term = 211; int year_length = 365; //Act SettingsPage settingsPage = new SettingsPage(driver); settingsPage.SelectNumberFormat.SelectByText(number_format); settingsPage.Save(); DepositPage depositPage = new DepositPage(driver); depositPage.SelectFinYear(fin_year); depositPage.SetAmountRateTerm(amount, rate, term); depositPage.Calculate(); //Assert Assert.AreEqual(Math.Round(amount * rate * term / 100 / year_length, 2).ToString("N", settingsPage.GetSelectedNFI(number_format)), depositPage.InterestStr); }
public void DateIsSavingInSelectedFormat(String dateFormat, int term) { //Arrange DepositPage depositPage = new DepositPage(driver); DateTime startDate = depositPage.StartDate; DateTime endDate = startDate.AddDays(term); String strStartDate = startDate.ToString(dateFormat, CultureInfo.InvariantCulture); String strEndDate = endDate.ToString(dateFormat, CultureInfo.InvariantCulture); //Act SettingsPage settingsPage = depositPage.OpenSettingsPage(); settingsPage.SelectDateFormat.SelectByText(dateFormat); settingsPage.Save(); depositPage.SetAmountRateTerm(1, 1, term); depositPage.Calculate(); HistoryPage historyPage = depositPage.OpenHistoryPage(); String histStartDate = historyPage.GetDateFrom(1); String histEndDate = historyPage.GetDateTo(1); //Assert Assert.AreEqual(strStartDate, histStartDate, "Start Date value is wrong."); Assert.AreEqual(strEndDate, histEndDate, "End Date value is wrong."); }
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); }
public DepositPageEdges(HomePage parent) { _driver = parent.PageDriver; _depositPage = new DepositPage(_driver); _rootNeighbours.Add(new HomePageEdges(parent)); }