示例#1
0
        public void Dashboard_Home_Giving_BigNumber_DifferentStartDay()
        {
            TestBaseWebDriver test    = base.TestContainer[Gallio.Framework.TestContext.CurrentContext.Test.Name];
            GeneralMethods    utility = test.GeneralMethods;
            DateTime          now     = TimeZoneInfo.ConvertTimeFromUtc(DateTime.UtcNow, TimeZoneInfo.FindSystemTimeZoneById("Central Standard Time"));

            string[] startDays = new string[] { "sunday", "monday", "tuesday", "wednesday", "thursday", "friday", "saturday" };

            try
            {
                int churchId = test.SQL.FetchChurchID(test.Dashboard.ChurchCode);
                int userId   = test.SQL.User_FetchID(churchId, test.Dashboard.DashboardEmail, test.Dashboard.DashboardUsername);

                test.Dashboard.LoginWebDriver();
                test.GeneralMethods.WaitForPageIsLoaded();
                DashboardHomePage     home     = new DashboardHomePage(test.Driver, test.GeneralMethods);
                DashboardSettingsPage settings = new DashboardSettingsPage(test.Driver, test.GeneralMethods, test.SQL);
                home.openSettingsPage();
                settings.turnOnWidget(1);
                settings.closeSettingsPage();

                home.selectView("week");

                foreach (string startDay in startDays)
                {
                    home.selectStartDay(startDay);

                    string bigNumber      = home.getWidgetBigNumber(1);
                    double subTotalOnPage = double.Parse(bigNumber.Replace("$", "").Replace(",", ""));

                    DateTime[] dateRange    = test.Dashboard.getDateRange(now, "week", test.Dashboard.getIntStartDay(startDay));
                    double     subTotalInDb = test.SQL.Dashboard_Giving_GetPeriodSum(churchId, userId, dateRange[0], dateRange[1]);

                    //verify the big number on page is correct
                    TestLog.WriteLine(string.Format("{0}|{1}", subTotalOnPage, subTotalInDb));
                    Assert.AreEqual(subTotalOnPage, subTotalInDb);
                }
            }
            finally
            {
                //clear test data
            }
        }