예제 #1
0
        public void MikeScenarioFileService_MikeScenarioImport_Test()
        {
            //        AppTaskID TVItemID    TVItemID2 AppTaskCommand  AppTaskStatus PercentCompleted    Parameters Language    StartDateTime_UTC EndDateTime_UTC EstimatedLength_second RemainingTime_second    LastUpdateDate_UTC LastUpdateContactTVItemID
            //17907   381362  381362  3   1   1 ||| TVItemID,12110 ||| UploadClientPath,E:\CSSP\Modelling\Mike21\New Brunswick\Cap - Pele\Model\Model Inputs\||| 1   2019 - 09 - 30 20:00:08.687 NULL NULL    NULL   2019 - 09 - 30 20:00:08.697 2

            foreach (LanguageEnum LanguageRequest in new List <LanguageEnum>()
            {
                LanguageEnum.en, LanguageEnum.fr
            })
            {
                SetupTest(LanguageRequest);

                int MikeScenarioTVItemID = 381362;

                string Parameters = $@"|||TVItemID,12110|||UploadClientPath,E:\CSSP\Modelling\Mike21\New Brunswick\Cap-Pele\Model\Model Inputs\|||";

                AppTaskModel appTaskModel = new AppTaskModel()
                {
                    AppTaskID                 = 100000,
                    TVItemID                  = MikeScenarioTVItemID,
                    TVItemID2                 = MikeScenarioTVItemID,
                    AppTaskCommand            = AppTaskCommandEnum.MikeScenarioImport,
                    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;

                MikeScenarioFileService _MikeScenarioFileService = new MikeScenarioFileService(taskRunnerBaseService);
                _MikeScenarioFileService.MikeScenarioImportDB();
                Assert.AreEqual(0, taskRunnerBaseService._BWObj.TextLanguageList.Count);

                break;
            }
        }
예제 #2
0
        public void MikeScenarioFileService_MikeScenarioAskToRun_Test()
        {
            // AppTaskID TVItemID    TVItemID2 AppTaskCommand  AppTaskStatus PercentCompleted    Parameters Language    StartDateTime_UTC EndDateTime_UTC EstimatedLength_second RemainingTime_second    LastUpdateDate_UTC LastUpdateContactTVItemID
            // 14895   337049  337049  2   1   1 ||| MikeScenarioTVItemID,337049 ||| 1   2018 - 10 - 17 12:04:21.687 NULL NULL    NULL    2018 - 10 - 17 12:04:21.687 2
            foreach (LanguageEnum LanguageRequest in new List <LanguageEnum>()
            {
                LanguageEnum.en, LanguageEnum.fr
            })
            {
                SetupTest(LanguageRequest);

                int MikeScenarioTVItemID = 337049;

                string Parameters = $"|||MikeScenarioTVItemID,{ MikeScenarioTVItemID }|||";

                AppTaskModel appTaskModel = new AppTaskModel()
                {
                    AppTaskID                 = 100000,
                    TVItemID                  = MikeScenarioTVItemID,
                    TVItemID2                 = MikeScenarioTVItemID,
                    AppTaskCommand            = AppTaskCommandEnum.MikeScenarioAskToRun,
                    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;

                MikeScenarioFileService _MikeScenarioFileService = new MikeScenarioFileService(taskRunnerBaseService);
                _MikeScenarioFileService.MikeScenarioAskToRun();
                Assert.AreEqual(0, taskRunnerBaseService._BWObj.TextLanguageList.Count);

                break;
            }
        }
예제 #3
0
        public void MikeScenarioFileService_MikeScenarioPrepareResults_Test()
        {
            foreach (LanguageEnum LanguageRequest in new List <LanguageEnum>()
            {
                LanguageEnum.en, LanguageEnum.fr
            })
            {
                SetupTest(LanguageRequest);

                int MikeScenarioTVItemID = 357139;

                string Parameters = $"|||MikeScenarioTVItemID,{ MikeScenarioTVItemID }|||";

                AppTaskModel appTaskModel = new AppTaskModel()
                {
                    AppTaskID                 = 100000,
                    TVItemID                  = MikeScenarioTVItemID,
                    TVItemID2                 = MikeScenarioTVItemID,
                    AppTaskCommand            = AppTaskCommandEnum.MikeScenarioPrepareResults,
                    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
                };

                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;

                MikeScenarioFileService _MikeScenarioFileService = new MikeScenarioFileService(taskRunnerBaseService);
                _MikeScenarioFileService.MikeScenarioPrepareResults();
                Assert.AreEqual(0, taskRunnerBaseService._BWObj.TextLanguageList.Count);

                break;
            }
        }
예제 #4
0
        public void MikeScenarioFileService_CreateInititalConditionFileSalAndTempFromTVFileItemID_Test()
        {
            foreach (LanguageEnum LanguageRequest in new List <LanguageEnum>()
            {
                LanguageEnum.en, LanguageEnum.fr
            })
            {
                SetupTest(LanguageRequest);

                int MikeScenarioTVItemID = 357139;

                string Parameters = $"|||not important|||";

                AppTaskModel appTaskModel = new AppTaskModel()
                {
                    AppTaskID                 = 100000,
                    TVItemID                  = MikeScenarioTVItemID,
                    TVItemID2                 = MikeScenarioTVItemID,
                    AppTaskCommand            = AppTaskCommandEnum.Error,
                    AppTaskStatus             = AppTaskStatusEnum.Error,
                    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;

                MikeScenarioFileService _MikeScenarioFileService = new MikeScenarioFileService(taskRunnerBaseService);

                TVItemModel tvItemModelMikeScenario = _TVItemService.GetTVItemModelWithTVItemIDDB(MikeScenarioTVItemID);
                Assert.AreEqual("", tvItemModelMikeScenario.Error);

                MikeScenarioModel mikeScenarioModel = _MikeScenarioService.GetMikeScenarioModelWithMikeScenarioTVItemIDDB(MikeScenarioTVItemID);
                Assert.AreEqual("", mikeScenarioModel.Error);

                TVFileModel tvFileModelM21_3FM = _TVFileService.GetTVFileModelWithTVItemIDAndTVFileTypeM21FMOrM3FMDB(MikeScenarioTVItemID);
                Assert.AreEqual("", tvFileModelM21_3FM.Error);

                string ServerPath = _TVFileService.GetServerFilePath(MikeScenarioTVItemID);

                FileInfo fiM21_M3 = new FileInfo(ServerPath + tvFileModelM21_3FM.ServerFileName);
                Assert.AreEqual(true, fiM21_M3.Exists);

                _MikeScenarioFileService.CreateInititalConditionFileSalAndTempFromTVFileItemID(MikeScenarioTVItemID, (int)mikeScenarioModel.UseSalinityAndTemperatureInitialConditionFromTVFileTVItemID, fiM21_M3);
                Assert.AreEqual(0, taskRunnerBaseService._BWObj.TextLanguageList.Count);

                break;
            }
        }