コード例 #1
0
        public void FillElementLayerList_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,30|||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         = 30;
                string ContourValues        = "14 88";
                int    Year = 2017;

                FileInfo        fi              = new FileInfo(@"C:\Users\leblancc\Desktop\TestHTML\FillElementLayerList_" + LanguageRequest.ToString() + ".KML");
                StringBuilder   sbKML           = new StringBuilder();
                string          Parameters      = $"|||TVItemID,{ MikeScenarioTVItemID }|||ReportTypeID,{ ReportTypeID }|||CoutourValues,{ 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              = sbKML;
                parameterService.Parameters      = Parameters;
                parameterService.reportTypeModel = reportTypeModel;
                parameterService.TVItemID        = MikeScenarioTVItemID;
                parameterService.Year            = Year;

                DfsuFile            dfsuFile            = null;
                List <Element>      elementList         = new List <Element>();
                List <ElementLayer> elementLayerList    = new List <ElementLayer>();
                List <NodeLayer>    topNodeLayerList    = new List <NodeLayer>();
                List <NodeLayer>    bottomNodeLayerList = new List <NodeLayer>();
                List <Node>         nodeList            = new List <Node>();

                dfsuFile = parameterService.GetTransportDfsuFile();
                Assert.IsNotNull(dfsuFile);
                Assert.AreEqual(0, taskRunnerBaseService._BWObj.TextLanguageList.Count);

                StringBuilder sbTemp  = new StringBuilder();
                bool          retBool = parameterService.FillRequiredList(dfsuFile, elementList, elementLayerList, nodeList, topNodeLayerList, bottomNodeLayerList);
                Assert.AreEqual(true, retBool);
                Assert.AreEqual(15829, nodeList.Count);
                Assert.AreEqual(22340, elementLayerList.Count);
                Assert.AreEqual(22340, elementList.Count);

                try
                {
                    dfsuFile.Close();
                }
                catch (Exception)
                {
                    // nothing
                }

                break;
            }
        }