public void LookupAccountDetail_Facebook()
        {
            //Get four specified campaigns form Customized Campaign Array
            string[] gettingcampaignArray = UITestFramework.Object.Campaign.GetCampaignArray();
            TestHelper.GetCampaignArray(gettingcampaignArray);

            //Prepare download Performance data
            Facebook.UITestFramework.UIMaps.PerformanceDataClasses.PerformanceData performanceData = new UITestFramework.UIMaps.PerformanceDataClasses.PerformanceData();
            TestHelper.PrepareDownloadPerformanceData(performanceData);

            //Get Date range from GridViewTable cell
            Common.UITestFramework.UIMaps.DetailedInfoForDownloadClasses.DetailedInfoForDownload performanceDataInfo = new Common.UITestFramework.UIMaps.DetailedInfoForDownloadClasses.DetailedInfoForDownload();
            performanceDataInfo.UIDetailedInfoforDownlWindow1.WaitForControlExist();
            string performanceDateRange;
            TestHelper.GetPerformanceDateRange(performanceDataInfo, out performanceDateRange);

            //Downloading performance data and verify it
            TestHelper.DownloadPerformanceData(performanceDataInfo, performanceDateRange, performanceDataInfo.VerifyDownloadPerformanceData);

            //Get Performance data from datagrid view
            performanceData.ClickAccountDetailTab();
            WinRow performanceRow;
            DataRow[] rows;
            string specifiedFileName = ConfigurationManager.AppSettings.Get("TopCampaignCSV");
            Facebook.UITestFramework.UIMaps.PerformanceDataClasses.PerformanceData performancePanel = new UITestFramework.UIMaps.PerformanceDataClasses.PerformanceData();
            foreach (string campaignName in gettingcampaignArray)
            {
                performancePanel.UIAccount2348004880USDWindow.UIItemWindow.UIItemTable.UIDataPanelClient.TryGetOneRowByName(
                    performancePanel.UIAccount2348004880USDWindow.UIItemWindow.UIRow1Row, campaignName, out performanceRow);
                Facebook.UITestFramework.Object.AccountDetails campaignObjectInGrid = Facebook.UITestFramework.Object.AccountDetails.Parse(performanceRow);
                rows = TestHelper.GetPerformanceDataFromCSV(campaignName, specifiedFileName);
                Facebook.UITestFramework.Object.AccountDetails campaignPerformanceInCSV = Facebook.UITestFramework.Object.AccountDetails.FetchPerformance(rows);
                if (campaignPerformanceInCSV != null)
                {
                    Assert.AreEqual<Facebook.UITestFramework.Object.AccountDetails>(campaignPerformanceInCSV, campaignObjectInGrid, "The Facebook campaign performance datas are not correct!!");
                }
            }

            //Drag the ScrollBar
            Mouse.MoveScrollWheel(performanceData.UIAccount2348004880USDWindow.UIItemWindow2.UIVerticalScrollBar.UIPositionIndicator, 1, System.Windows.Input.ModifierKeys.None);
            specifiedFileName = ConfigurationManager.AppSettings.Get("TopAdsCSV");
            foreach (string campaignName in gettingcampaignArray)
            {
                performancePanel.UIAccount2348004880USDWindow.UIItemWindow.UIItemTable.UIDataPanelClient.TryGetOneRowByName(
                    performancePanel.UIAccount2348004880USDWindow.UIItemWindow1.UIItemTable.UIDataPanelClient.UIRow1Row, campaignName, out performanceRow);
                Facebook.UITestFramework.Object.AccountDetails campaignObjectInGrid = Facebook.UITestFramework.Object.AccountDetails.Parse(performanceRow);
                rows = TestHelper.GetPerformanceDataFromCSV(campaignName, specifiedFileName);
                Facebook.UITestFramework.Object.AccountDetails campaignPerformanceInCSV = Facebook.UITestFramework.Object.AccountDetails.FetchPerformance(rows);
                if (campaignPerformanceInCSV != null)
                {
                    Assert.AreEqual<Facebook.UITestFramework.Object.AccountDetails>(campaignPerformanceInCSV, campaignObjectInGrid, "The Facebook campaign performance datas are not correct!!");
                }
            }
        }
        public static void GetAllCampaignsUI(Action verifyMethod)
        {
            int retryTimes = 10;
            Common.UITestFramework.UIMaps.DownloadAccountWindowClasses.DownloadAccountWindow downloadAccountWindow = new Common.UITestFramework.UIMaps.DownloadAccountWindowClasses.DownloadAccountWindow();

            do
            {
                //Select campaign in Download Account Window
                downloadAccountWindow.UIDownloadAccounthaihaWindow.WaitForControlExist();

                System.Threading.Thread.Sleep(int.Parse(ConfigurationManager.AppSettings["DefaultPollingRetryWaitTime"]));
            }
            while (!downloadAccountWindow.SelectAllCampaigns() && (retryTimes--) != 0);

            if (retryTimes == 0)
            {
                throw new Exception("Fail to select all campaigns in download account window!!");
            }

            //Click Yes Button on Warning Window
            Common.UITestFramework.UIMaps.WarningWindowClasses.WarningWindow warningWindow = new Common.UITestFramework.UIMaps.WarningWindowClasses.WarningWindow();
            bool worningWindowExist = warningWindow.UIWarningWindow.WaitForControlExist();
            if (worningWindowExist)
            {
                warningWindow.ClickYesButton();
                warningWindow.UIWarningWindow.WaitForControlNotExist();
            }
            downloadAccountWindow.UIDownloadAccounthaihaWindow.WaitForControlNotExist();

            Common.UITestFramework.UIMaps.DetailedInfoForDownloadClasses.DetailedInfoForDownload detailedInfoForDownloadWindow = new Common.UITestFramework.UIMaps.DetailedInfoForDownloadClasses.DetailedInfoForDownload();
            detailedInfoForDownloadWindow.UIDetailedInfoforDownlWindow.WaitForControlExist();
            detailedInfoForDownloadWindow.UIDataGridViewTableForJob.WaitingForStatusEqual("Finished", detailedInfoForDownloadWindow);

            //Verify Account Name -> Campaign Name and Information panel
            verifyMethod();

            //Click close button
            detailedInfoForDownloadWindow.ClickCloseButton();
            detailedInfoForDownloadWindow.UIDetailedInfoforDownlWindow.WaitForControlNotExist();
        }
        public static void GetCampaignArray(string[] campaignArrayName, Action verifyMethod)
        {
            int retryTimes = 10;
            Common.UITestFramework.UIMaps.DownloadAccountWindowClasses.DownloadAccountWindow downloadAccountWindow = new Common.UITestFramework.UIMaps.DownloadAccountWindowClasses.DownloadAccountWindow();

            do
            {
                //Select campaign in Download Account Window
                downloadAccountWindow.UIDownloadAccounthaihaWindow.WaitForControlExist();

                System.Threading.Thread.Sleep(int.Parse(ConfigurationManager.AppSettings["DefaultPollingRetryWaitTime"]));
            }
            while (!downloadAccountWindow.SelectCampaign(campaignArrayName) && (retryTimes--) != 0);

            if (retryTimes == 0)
            {
                StringBuilder campaignNames = new StringBuilder();
                foreach (string campaignName in campaignArrayName)
                {
                    campaignNames.Append(campaignName).Append(" ");
                }
                throw new Exception("Fail to select campaign name '" + campaignNames.ToString() + "' in download account window!!");
            }

            //Click Yes Button on Warning Window
            Common.UITestFramework.UIMaps.WarningWindowClasses.WarningWindow warningWindow = new Common.UITestFramework.UIMaps.WarningWindowClasses.WarningWindow();
            bool worningWindowExist = warningWindow.UIWarningWindow.WaitForControlExist();
            if (worningWindowExist)
            {
                warningWindow.ClickYesButton();
                warningWindow.UIWarningWindow.WaitForControlNotExist();
            }

            downloadAccountWindow.UIDownloadAccounthaihaWindow.WaitForControlNotExist();

            Common.UITestFramework.UIMaps.DetailedInfoForDownloadClasses.DetailedInfoForDownload detailedInfoForDownloadWindow = new Common.UITestFramework.UIMaps.DetailedInfoForDownloadClasses.DetailedInfoForDownload();
            detailedInfoForDownloadWindow.UIDetailedInfoforDownlWindow.WaitForControlExist();
            detailedInfoForDownloadWindow.UIDataGridViewTableForJob.WaitingForStatusPropertyEqual("Finished");

            //Verify Account Name and Information panel
            verifyMethod();

            //Click close button
            detailedInfoForDownloadWindow.ClickCloseButton();
            detailedInfoForDownloadWindow.UIDetailedInfoforDownlWindow.WaitForControlNotExist();
        }
        public void LookupAdsPerformanceData_Facebook()
        {
            //Get four specified campaigns form Customized Campaign Array
            string[] gettingcampaignArray = UITestFramework.Object.Campaign.GetCampaignArray();
            TestHelper.GetCampaignArray(gettingcampaignArray);

            //Prepare download Performance data
            Facebook.UITestFramework.UIMaps.PerformanceDataClasses.PerformanceData performanceData = new UITestFramework.UIMaps.PerformanceDataClasses.PerformanceData();
            TestHelper.PrepareDownloadPerformanceData(performanceData);

            //Get Date range from GridViewTable cell
            Common.UITestFramework.UIMaps.DetailedInfoForDownloadClasses.DetailedInfoForDownload performanceDataInfo = new Common.UITestFramework.UIMaps.DetailedInfoForDownloadClasses.DetailedInfoForDownload();
            performanceDataInfo.UIDetailedInfoforDownlWindow1.WaitForControlExist();
            string performanceDateRange;
            TestHelper.GetPerformanceDateRange(performanceDataInfo, out performanceDateRange);

            //Downloading performance data and verify it
            TestHelper.DownloadPerformanceData(performanceDataInfo, performanceDateRange, performanceDataInfo.VerifyDownloadPerformanceData);

            //Get Performance data from datagrid view
            performanceData.ClickAdsTab();
            List<WinRow> performanceRows = new List<WinRow>();
            DataRow[] rows;
            string specifiedFileName = ConfigurationManager.AppSettings.Get("AdsCSV");
            Facebook.UITestFramework.UIMaps.PerformanceDataClasses.PerformanceData performancePanel = new UITestFramework.UIMaps.PerformanceDataClasses.PerformanceData();
            Facebook.UITestFramework.Object.AdsPerformance oneRowInGrid = null;
            Facebook.UITestFramework.Object.AdsPerformance oneRowInCSV = null;
            foreach (string campaignName in gettingcampaignArray)
            {
                performancePanel.UIAccount2348004880USDWindow.UIItemWindow.UIItemTable.UIDataPanelClient.TryGetSomeRowsByName(
                    performancePanel.UIAccount2348004880USDWindow.UIItemWindow.UINewItemRowRow, campaignName, performanceRows);
                Facebook.UITestFramework.Object.AdsPerformance[] campaignObjectInGrid = Facebook.UITestFramework.Object.AdsPerformance.Parse(performanceRows);
                rows = TestHelper.GetPerformanceDataFromCSV(campaignName, specifiedFileName);
                Facebook.UITestFramework.Object.AdsPerformance[] campaignPerformanceInCSV = Facebook.UITestFramework.Object.AdsPerformance.FetchPerformance(rows);
                for (int i = 0; i < rows.Length; i++)
                {
                    oneRowInCSV = campaignPerformanceInCSV[i];
                    oneRowInGrid = campaignObjectInGrid[i];
                    Assert.AreEqual<Facebook.UITestFramework.Object.AdsPerformance>(oneRowInCSV, oneRowInGrid, "The Facebook campaign performance datas are not correct!!");
                }
            }
        }
        public void LookupAccountSummary_Facebook()
        {
            //Get four specified campaigns form Customized Campaign Array
            string[] gettingcampaignArray = UITestFramework.Object.Campaign.GetCampaignArray();
            TestHelper.GetCampaignArray(gettingcampaignArray);

            //Prepare download Performance data
            Facebook.UITestFramework.UIMaps.PerformanceDataClasses.PerformanceData performanceData = new UITestFramework.UIMaps.PerformanceDataClasses.PerformanceData();
            TestHelper.PrepareDownloadPerformanceData(performanceData);

            //Get Date range from GridViewTable cell
            Common.UITestFramework.UIMaps.DetailedInfoForDownloadClasses.DetailedInfoForDownload performanceDataInfo = new Common.UITestFramework.UIMaps.DetailedInfoForDownloadClasses.DetailedInfoForDownload();
            performanceDataInfo.UIDetailedInfoforDownlWindow1.WaitForControlExist();
            string performanceDateRange;
            TestHelper.GetPerformanceDateRange(performanceDataInfo, out performanceDateRange);

            //Downloading performance data and verify it
            TestHelper.DownloadPerformanceData(performanceDataInfo, performanceDateRange, performanceDataInfo.VerifyDownloadPerformanceData);

            //Get Performance data from datagrid view
            performanceData.ClickCampaignsTab();
            WinRow performanceRow;
            DataRow[] rows;
            string specifiedFileName = ConfigurationManager.AppSettings.Get("AccountSummaryCSV");
            Facebook.UITestFramework.UIMaps.PerformanceDataClasses.PerformanceData performancePanel = new UITestFramework.UIMaps.PerformanceDataClasses.PerformanceData();
            foreach (string campaignName in gettingcampaignArray)
            {
                performancePanel.UIAccount2348004880USDWindow.UIItemWindow.UIItemTable.UIDataPanelClient.TryGetOneRowByName(
                    performancePanel.UIAccount2348004880USDWindow.UIGrdCtrSummaryWindow.UINoadsinthiscampaignrTable.UIDataPanelClient.UIRow1Row,
                    campaignName, out performanceRow);
                Facebook.UITestFramework.Object.AccountSummary campaignObjectInGrid = Facebook.UITestFramework.Object.AccountSummary.Parse(performanceRow);
                rows = TestHelper.GetPerformanceDataFromCSV(campaignName, specifiedFileName);
                Facebook.UITestFramework.Object.AccountSummary campaignPerformanceInCSV = Facebook.UITestFramework.Object.AccountSummary.FetchPerformance(rows);
                if (campaignPerformanceInCSV != null)
                {
                    Assert.AreEqual<Facebook.UITestFramework.Object.AccountSummary>(campaignPerformanceInCSV, campaignObjectInGrid, "The Facebook campaign performance datas are not correct!!");
                }
            }
        }