示例#1
0
        public async Task ChartData_Calculate_Correct()
        {
            // Settings
            CultureInfo.CurrentCulture = new CultureInfo("da");

            // Add total tag
            await DatabaseHelper.AddTotalTag(DbContext);

            // Arrange
            var localizationService = MockHelper.GetLocalizationService();
            var dashboardViews      = DashboardHelpers.GetChartDataDashBoards();

            foreach (var(key, value) in dashboardViews)
            {
                Console.WriteLine($"Check template: {value}");

                // Act
                foreach (var itemViewModel in key.Items)
                {
                    var newItemViewModel = DashboardHelpers.CopyDashboardItem(itemViewModel);
                    var dashboardItem    = DashboardHelpers.GetDashboardItemFromModel(itemViewModel);

                    await ChartDataHelpers.CalculateDashboardItem(
                        newItemViewModel,
                        DbContext,
                        dashboardItem,
                        localizationService,
                        key.LocationId,
                        key.TagId,
                        key.SurveyId,
                        key.AnswerDates);

                    DashboardHelpers.CheckData(itemViewModel, newItemViewModel, key, value);
                }
            }
        }