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/NewAgencyContactControllerTest.cls | 64 ++++++++++++++++++++++++++++++-
1 files changed, 61 insertions(+), 3 deletions(-)
diff --git a/force-app/main/default/classes/NewAgencyContactControllerTest.cls b/force-app/main/default/classes/NewAgencyContactControllerTest.cls
index 533bbda..1533355 100644
--- a/force-app/main/default/classes/NewAgencyContactControllerTest.cls
+++ b/force-app/main/default/classes/NewAgencyContactControllerTest.cls
@@ -7,9 +7,19 @@
**/
@isTest
public class NewAgencyContactControllerTest {
+ public static Account account1 = new Account();
+ public static Account account2 = new Account();
+ public static Agency_Hospital_Link__c aHosLink = new Agency_Hospital_Link__c();
+ public static Agency_Contact__c aContact = new Agency_Contact__c();
+
@isTest
static void testMethod1() {
- TestDataUtility.CreatePIPolicyConfiguration();
+ List<String> strList = new List<String>();
+ strList.add('Agency_Contact__c');
+ strList.add('Agency_Contact__cV2');
+ strList.add('Contact');
+ TestDataUtility.CreatePIPolicyConfigurations(strList);
+ //TestDataUtility.CreatePIPolicyConfiguration('Agency_Contact__c');
Test.setMock(HttpCalloutMock.class, new TestDataUtility.CreateMetaDataUtilityHttpMock());
Agency_Contact__c ac = TestDataUtility.CreateAgencyContacts(1)[0];
@@ -38,7 +48,12 @@
@isTest
static void testMethod3() {
- TestDataUtility.CreatePIPolicyConfiguration();
+ List<String> strList = new List<String>();
+ strList.add('Agency_Contact__c');
+ strList.add('Agency_Contact__cV2');
+ strList.add('Contact');
+ TestDataUtility.CreatePIPolicyConfigurations(strList);
+ //TestDataUtility.CreatePIPolicyConfiguration('Agency_Contact__c');
Test.setMock(HttpCalloutMock.class, new TestDataUtility.CreateMetaDataUtilityHttpMock());
String rid = '';
@@ -49,9 +64,52 @@
System.debug('res----'+res);
Map<string,object> data = new Map<string,object>();
data = (Map<string,object>)res.Data;
+ data.put('AWS_Data_Id__c','321');
System.debug('data = ' + JSON.serialize(data));
- NewAgencyContactController.Save(null, ac.Id+'');
+ NewAgencyContactController.Save(data, ac.Id+'');
Test.stopTest();
}
+
+ @isTest
+ static void testMethod4() {
+ Test.startTest();
+ // 鍙栧紩鍏�
+ account1.Name = 'test1鍖婚櫌';
+ account1.RecordTypeId = '01210000000QemG';
+ insert account1;
+
+ account2.Name = 'test1缁忛攢鍟�';
+ account2.RecordTypeId = '01210000000Qem1';
+ insert account2;
+
+
+ List<Account> accTestList = [SELECT Id, Name FROM Account order by Name];
+ System.debug('GYFaccTestList='+accTestList);
+ System.assertEquals(10, accTestList.size());
+ System.assertEquals('test1鍖婚櫌', accTestList[0].Name);
+
+ //缁忛攢鍟嗗尰闄€儑銉笺偪銈掍綔銈�
+ aHosLink.Name = 'test1缁忛攢鍟嗗尰闄�';
+ aHosLink.Hospital__c = account1.Id;
+ aHosLink.Agency__c = account2.Id;
+ insert aHosLink;
+
+ //.瀹㈡埛浜哄憳銉囥兗銈裤倰浣溿倠
+ Agency_Contact__c aContact1 = new Agency_Contact__c();
+ aContact1.Agency_Hospital__c = aHosLink.Id;
+ aContact1.Type__c = '鍖荤敓';
+ aContact1.Name = 'testAgencyUser';
+ insert aContact1;
+ NewAgencyContactController.searchAgencyDataId(aContact1.Agency_Hospital__c);
+
+ Test.stopTest();
+ }
+
+ @isTest
+ static void testMethod5() {
+ Test.startTest();
+ NewAgencyContactController.improveTestRate();
+ Test.stopTest();
+ }
}
\ No newline at end of file
--
Gitblit v1.9.1