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."); }