示例#1
0
        public void TOUChart(CostUsageData input)
        {
            CostUsage.SelectHierarchy(input.InputData.Hierarchies);
            JazzMessageBox.LoadingMask.WaitSubMaskLoading();
            TimeManager.MediumPause();

            //Change manually defined time range to 2012/07/04-2012/09/03.
            var ManualTimeRange = input.InputData.ManualTimeRange;

            EnergyViewToolbar.SetDateRange(ManualTimeRange[0].StartDate, ManualTimeRange[0].EndDate);

            //Select Commodity=电, change to TOU chart.
            CostUsage.SelectCommodity(input.InputData.commodityNames);
            EnergyViewToolbar.ShowPeakValley();
            JazzMessageBox.LoadingMask.WaitChartMaskerLoading();
            TimeManager.MediumPause();
            Assert.IsTrue(CostUsage.IsTrendChartDrawn());

            //Check value
            CostUsage.ExportExpectedDataTableToExcel(input.ExpectedData.expectedFileName[0], DisplayStep.Default);
            TimeManager.MediumPause();
            CostUsage.CompareDataViewCostUsage(input.ExpectedData.expectedFileName[0], input.InputData.failedFileName[0]);

            //change to column chart view
            JazzFunction.EnergyViewToolbar.View(EnergyViewType.Column);
            JazzMessageBox.LoadingMask.WaitChartMaskerLoading();
            TimeManager.MediumPause();
            Assert.IsTrue(CostUsage.IsColumnChartDrawn());

            //Try to click Optional step=Raw.
            CostUsage.ClickDisplayStep(DisplayStep.Min);
            JazzMessageBox.LoadingMask.WaitChartMaskerLoading();
            TimeManager.MediumPause();

            //· Warning message pop up show "峰谷不支持Raw"
            Assert.IsTrue(JazzMessageBox.MessageBox.GetMessage().Contains(input.ExpectedData.StepMessage[0]));
            JazzMessageBox.MessageBox.OK();
            TimeManager.MediumPause();

            //Change other Optional step=Day/Week/Month
            CostUsage.ClickDisplayStep(DisplayStep.Month);
            JazzMessageBox.LoadingMask.WaitChartMaskerLoading();
            TimeManager.MediumPause();

            //· Pie chart display correctly. TOU column value are calculate correctly.
            Assert.IsTrue(CostUsage.IsColumnChartDrawn());

            //Change to Stack chart.
            JazzFunction.EnergyViewToolbar.View(EnergyViewType.Stack);
            JazzMessageBox.LoadingMask.WaitChartMaskerLoading();
            TimeManager.MediumPause();

            CostUsage.ClickDisplayStep(DisplayStep.Week);
            JazzMessageBox.LoadingMask.WaitChartMaskerLoading();
            TimeManager.MediumPause();

            //· Stack chart display correctly.
            Assert.IsTrue(CostUsage.IsColumnChartDrawn());

            CostUsage.ClickDisplayStep(DisplayStep.Day);
            JazzMessageBox.LoadingMask.WaitChartMaskerLoading();
            TimeManager.MediumPause();

            //· Stack chart display correctly.
            Assert.IsTrue(CostUsage.IsColumnChartDrawn());

            //Nancy add TOU pie chart, please make it work as well.
            JazzFunction.EnergyViewToolbar.View(EnergyViewType.Distribute);
            JazzMessageBox.LoadingMask.WaitChartMaskerLoading();
            TimeManager.MediumPause();
            Assert.IsTrue(CostUsage.IsPieChartDrawn());

            //Click "Save to dashboard"(保存到仪表盘)to save the Pie chart to Hierarchy node dashboard.
            var dashboard = input.InputData.DashboardInfo;

            EnergyViewToolbar.SaveToDashboard(dashboard.WigetName, dashboard.HierarchyName, dashboard.IsCreateDashboard, dashboard.DashboardName);
            TimeManager.LongPause();

            //+On homepage, check the dashboard
            CostUsage.NavigateToAllDashBoards();
            HomePagePanel.SelectHierarchyNode(dashboard.HierarchyName);
            TimeManager.LongPause();
            TimeManager.LongPause();
            HomePagePanel.ClickDashboardButton(dashboard.DashboardName);
            JazzMessageBox.LoadingMask.WaitDashboardHeaderLoading();
            TimeManager.MediumPause();

            //Check ·The Pie chart Save to dashboard successfully.
            Assert.IsTrue(HomePagePanel.GetDashboardHeaderName().Contains(dashboard.DashboardName));
            Assert.IsTrue(HomePagePanel.IsWidgetExistedOnDashboard(dashboard.WigetName));
            HomePagePanel.MaximizeWidget(dashboard.WigetName);
            TimeManager.MediumPause();

            //Close the maximize widget for next case starting
            WidgetMaxChart.ClickCloseButton();
            TimeManager.MediumPause();
        }