Exemplo n.º 1
0
        public void Dashboard_Setting_DefaultFunds()
        {
            TestBaseWebDriver test    = base.TestContainer[Gallio.Framework.TestContext.CurrentContext.Test.Name];
            GeneralMethods    utility = test.GeneralMethods;

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

                test.Dashboard.LoginWebDriver();
                new DashboardHomePage(test.Driver, test.GeneralMethods).openSettingsPage();
                DashboardSettingsPage settings = new DashboardSettingsPage(test.Driver, test.GeneralMethods, test.SQL);

                ArrayList fundsInSql  = test.SQL.Dashboard_Giving_GetAllFundsName(churchId);
                ArrayList fundsOnPage = settings.getWidgetSubItemsOnPage(1);

                TestLog.WriteLine(fundsOnPage.Count);
                Assert.AreEqual(fundsInSql.Count, fundsOnPage.Count);

                foreach (var itemOnPage in fundsOnPage)
                {
                    bool flag = false;
                    TestLog.WriteLine(itemOnPage.ToString());
                    object[] funds = fundsInSql.ToArray();
                    for (int i = 0; i < funds.Length; i++)
                    {
                        if (funds[i].ToString().Replace(" ", "").Contains(itemOnPage.ToString().Replace(" ", "")))
                        {
                            flag = true;
                            TestLog.WriteLine(funds[i].ToString() + "|" + itemOnPage.ToString());
                            if (funds[i].ToString().Contains("inactive"))
                            {
                                Assert.IsTrue(settings.isWidgetItemInactive(1, i + 1));
                            }
                        }
                    }
                    Assert.IsTrue(flag);
                }
            }
            finally
            {
                //clear test data
            }
        }