From d8dc84a3d56df839895f1c417a4d9cbee763d262 Mon Sep 17 00:00:00 2001
From: 高章伟 <gaozhangwei@prec-tech.com>
Date: 星期五, 03 三月 2023 14:50:59 +0800
Subject: [PATCH] gzw 测试环境代码更新
---
force-app/main/default/classes/EventToEventDetailsScheduleTest.cls | 69 +++++++++++++++++++++++++++++++++-
1 files changed, 66 insertions(+), 3 deletions(-)
diff --git a/force-app/main/default/classes/EventToEventDetailsScheduleTest.cls b/force-app/main/default/classes/EventToEventDetailsScheduleTest.cls
index b933512..deab6d9 100644
--- a/force-app/main/default/classes/EventToEventDetailsScheduleTest.cls
+++ b/force-app/main/default/classes/EventToEventDetailsScheduleTest.cls
@@ -1,8 +1,71 @@
@isTest
private class EventToEventDetailsScheduleTest {
+ @TestSetup
+ static void makeData(){
+
+ Date toDayTime = Date.today();
+
+ Account hospital = new Account();
+ hospital.recordtypeId = [Select Id FROM RecordType WHERE IsActive = true and SobjectType = 'Account' and DeveloperName = 'HP'].id;
+ hospital.Name = 'hospitalabc';
+ hospital.Is_Active__c = '鏈夊姽';
+ hospital.Attribute_Type__c = '鍗敓閮�';
+ hospital.Speciality_Type__c = '缁煎悎鍖婚櫌';
+ hospital.Grade__c = '涓�绾�';
+ hospital.IF_Coverage_Target_HP__c = '1';
+ hospital.OCM_Category__c = 'SLTV';
+ hospital.Is_Medical__c = '鍖荤枟鏈烘瀯';
+ hospital.Town__c = '涓滀含';
+ Oly_TriggerHandler.bypass('NFM701ControllerHandler');
+ Oly_TriggerHandler.bypass('UpdateContractAimAmountHandler');
+ insert hospital;
+
+ Product2 pro1 = new Product2(Name='name01',IsActive=true,Family='GI',
+ Fixture_Model_No__c='n01',Serial_Lot_No__c='S/N tracing',
+ Fixture_Model_No_T__c = 'n01',
+ Maintenance_Price_Year__c = 999,
+ Extend_Gurantee_Start_MD__c = Date.newInstance(toDayTime.year(),3,2),
+ Extend_Gurantee_End_MD__c = Date.newInstance(3999,12,31),
+ Extend_new_product_gurantee_MD__c = true,
+ PartSupplyFinishDate__c = Date.newInstance(toDayTime.year()+2,3,2),
+ ProductCode_Ext__c='pc01',Manual_Entry__c=false,Brand_Name__c='濂ユ灄宸存柉',
+ Category2__c='鏈綋',
+ Category3__c='鐢靛瓙闀�');
+ insert pro1;
+
+ Account[] strategicDep = [SELECT ID, Name FROM Account WHERE parentId = :hospital.Id AND recordType.DeveloperName = 'Department_Class_OTH'];
+ // 瑷虹檪绉戙倰浣溿倠
+ Account dep = new Account();
+ dep.recordtypeId = [Select Id FROM RecordType WHERE IsActive = true and SobjectType = 'Account' and DeveloperName = 'Department_OTH'].id;
+ dep.Name = 'test dep';
+ dep.AgentCode_Ext__c = System.Label.Account_Asset_FJZ;
+ dep.ParentId = strategicDep[0].Id;
+ dep.Department_Class__c = strategicDep[0].Id;
+ dep.Hospital__c = hospital.Id;
+ Oly_TriggerHandler.bypass('NFM701ControllerHandler');
+ Oly_TriggerHandler.bypass('UpdateContractAimAmountHandler');
+ insert dep;
+ Asset assetA1 = new Asset(Asset_Owner__c = 'Olympus');
+ assetA1.RecordTypeId = System.Label.Asset_RecordType;
+ assetA1.SerialNumber = 'ass01';
+ assetA1.Name = 'ass01';
+ assetA1.AccountId = dep.Id;
+ assetA1.Guarantee_period_for_products__c = toDayTime;
+ assetA1.Hospital__c = hospital.Id;
+ assetA1.Product2Id = pro1.Id;
+ assetA1.Quantity = 1;
+ assetA1.IF_Coverage_Target_Asset__c = '1';
+ insert assetA1;
+
+ }
+
+
static testMethod void myUnitTest() {
- // This test runs a scheduled job at midnight Sept. 3rd. 2022
- String CRON_EXP = '0 0 0 3 9 ? 2022';
+ // List<Asset> Assets = [SELECT Id,Hospital__c,Product2.ServiceCategory__c,Product2.Maintenance_Price_Year__c
+ // FROM Asset WHERE IF_Coverage_Target_Asset__c = '1'];
+
+ // This test runs a scheduled job at midnight Sept. 3rd. 2022
+ String CRON_EXP = '0 0 0 3 9 ? 2023';
//System.Test.startTest();
// Schedule the test job
String jobId =
@@ -19,7 +82,7 @@
// Verify the job has not run
System.assertEquals(0, ct.TimesTriggered);
// Verify the next time the job will run
- System.assertEquals('2022-09-03 00:00:00',
+ System.assertEquals('2023-09-03 00:00:00',
String.valueOf(ct.NextFireTime));
//System.Test.stopTest();
}
--
Gitblit v1.9.1