예제 #1
0
        public void GenerateMikeScenarioPollutionAnimationKMZ_Test()
        {
            //AppTaskID TVItemID    TVItemID2 AppTaskCommand  AppTaskStatus PercentCompleted    Parameters Language    StartDateTime_UTC EndDateTime_UTC EstimatedLength_second RemainingTime_second    LastUpdateDate_UTC LastUpdateContactTVItemID
            //10371	336990	336990	19	2	1	|||TVItemID,336925|||ReportTypeID,31|||ContourValues,14 88|||	1	2018-02-12 14:25:06.863	NULL NULL    NULL	2018-02-12 14:25:07.663	2
            foreach (LanguageEnum LanguageRequest in new List <LanguageEnum>()
            {
                LanguageEnum.en, LanguageEnum.fr
            })
            {
                SetupTest(LanguageRequest);

                int    MikeScenarioTVItemID = 336990;
                int    ReportTypeID         = 31;
                string ContourValues        = "14 88";
                int    Year = 2017;

                FileInfo        fi              = new FileInfo(@"C:\Users\leblancc\Desktop\TestHTML\TestPolSourceAnimation" + LanguageRequest.ToString() + ".kml");
                StringBuilder   sbHTML          = new StringBuilder();
                string          Parameters      = $"|||TVItemID,{ MikeScenarioTVItemID }|||ReportTypeID,{ ReportTypeID }|||ContourValues,{ ContourValues }|||";
                ReportTypeModel reportTypeModel = _ReportTypeService.GetReportTypeModelWithReportTypeIDDB(ReportTypeID);

                AppTaskModel appTaskModel = new AppTaskModel()
                {
                    AppTaskID                 = 100000,
                    TVItemID                  = MikeScenarioTVItemID,
                    TVItemID2                 = MikeScenarioTVItemID,
                    AppTaskCommand            = AppTaskCommandEnum.CreateDocumentFromParameters,
                    AppTaskStatus             = AppTaskStatusEnum.Created,
                    PercentCompleted          = 1,
                    Parameters                = Parameters,
                    Language                  = LanguageRequest,
                    StartDateTime_UTC         = DateTime.Now,
                    EndDateTime_UTC           = null,
                    EstimatedLength_second    = null,
                    RemainingTime_second      = null,
                    LastUpdateDate_UTC        = DateTime.Now,
                    LastUpdateContactTVItemID = 2, // Charles LeBlanc
                };

                appTaskModel.AppTaskStatus = AppTaskStatusEnum.Running;

                BWObj bwObj = new BWObj()
                {
                    Index            = 1,
                    appTaskModel     = appTaskModel,
                    appTaskCommand   = appTaskModel.AppTaskCommand,
                    TextLanguageList = new List <TextLanguage>(),
                    bw = new BackgroundWorker(),
                };

                TaskRunnerBaseService taskRunnerBaseService = new TaskRunnerBaseService(new List <BWObj>()
                {
                    bwObj
                });

                taskRunnerBaseService._BWObj = bwObj;
                ParametersService parameterService = new ParametersService(taskRunnerBaseService);
                parameterService.fi              = fi;
                parameterService.sb              = sbHTML;
                parameterService.Parameters      = Parameters;
                parameterService.reportTypeModel = reportTypeModel;
                parameterService.TVItemID        = MikeScenarioTVItemID;
                parameterService.Year            = Year;

                StringBuilder sbTemp  = new StringBuilder();
                bool          retBool = parameterService.GenerateMikeScenarioPollutionAnimationKMZ();
                Assert.AreEqual(true, retBool);

                StreamWriter sw = fi.CreateText();
                sw.Write(parameterService.sb.ToString());
                sw.Close();

                break;
            }
        }