From e6068da47c1bef5517c9e5fdc8c726766867ad4e Mon Sep 17 00:00:00 2001
From: buli <137736985@qq.com>
Date: 星期五, 14 七月 2023 15:10:02 +0800
Subject: [PATCH] Merge branch 'master' into LEXUpgrade2023-Deloitte

---
 force-app/main/default/classes/lexSearchAgencyHospitalControllerTest.cls |  180 ++++++++++++++++++++++++++---------------------------------
 1 files changed, 79 insertions(+), 101 deletions(-)

diff --git a/force-app/main/default/classes/lexSearchAgencyHospitalControllerTest.cls b/force-app/main/default/classes/lexSearchAgencyHospitalControllerTest.cls
index b4bbcbf..41cad30 100644
--- a/force-app/main/default/classes/lexSearchAgencyHospitalControllerTest.cls
+++ b/force-app/main/default/classes/lexSearchAgencyHospitalControllerTest.cls
@@ -1,107 +1,85 @@
 @isTest
 private class lexSearchAgencyHospitalControllerTest {
-  @isTest
-  static void testInit() {
-    User myUser_test;
-    Account myAccount2;
-    Product2__c pro2;
-    User thisUser = [SELECT Id FROM User WHERE Id = :UserInfo.getUserId()];
-    System.runAs(thisUser) {
-      List<RecordType> rectCo = [
-        SELECT Id
-        FROM RecordType
-        WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '璨╁2搴�'
-      ];
-      if (rectCo.size() == 0) {
-        return;
-      }
-      Profile prof = [
-        SELECT Id
-        FROM Profile
-        WHERE Name = '901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�(ET Email)'
-      ];
-      Product2 prod02 = new Product2(
-        Name = 'Test02181',
-        ProductCode = 'Test0218',
-        Asset_Model_No__c = 'Test0218',
-        SFDA_Status__c = '鏈夊姽',
-        Dealer_special_Object__c = true,
-        SFDA_Approbation_No__c = 'Test002',
-        Packing_list_manual__c = 12,
-        SFDA_Expiration_Date__c = Date.today(),
-        Category5__c = 'tset8',
-        Manual_Entry__c = false
-      );
-      pro2 = new Product2__c(
-        Name = 'Pro002181',
-        OT_CODE_Text__c = 'Test002181',
-        Product2__c = prod02.Id
-      );
-      insert pro2;
-      myAccount2 = new Account(
-        name = 'Testaccount003',
-        Dealer_discount__c = 20,
-        RecordTypeId = rectCo[0].Id,
-        AgentCode_Ext__c = '2'
-      );
-      insert myAccount2;
+    @isTest
+    static void testInit() {
+        User myUser_test;
+        Account myAccount2;
+        Product2__c pro2;
+        User thisUser = [SELECT Id FROM User WHERE Id = :UserInfo.getUserId()];
+        System.runAs(thisUser) {
+            List<RecordType> rectCo = [SELECT Id FROM RecordType WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '璨╁2搴�'];
+            if (rectCo.size() == 0) {
+                return;
+            }
+            Profile prof = [SELECT Id FROM Profile WHERE Name = '901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�(ET Email)'];
+            Product2 prod02 = new Product2(
+                Name = 'Test02181',
+                ProductCode = 'Test0218',
+                Asset_Model_No__c = 'Test0218',
+                SFDA_Status__c = '鏈夊姽',
+                Dealer_special_Object__c = true,
+                SFDA_Approbation_No__c = 'Test002',
+                Packing_list_manual__c = 12,
+                SFDA_Expiration_Date__c = Date.today(),
+                Category5__c = 'tset8',
+                Manual_Entry__c = false
+            );
+            pro2 = new Product2__c(Name = 'Pro002181', OT_CODE_Text__c = 'Test002181', Product2__c = prod02.Id);
+            insert pro2;
+            myAccount2 = new Account(name = 'Testaccount003', Dealer_discount__c = 20, RecordTypeId = rectCo[0].Id, AgentCode_Ext__c = '2');
+            insert myAccount2;
 
-      Contact core = new Contact(
-        email = 'wan@salesforce.com',
-        firstname = 'wan',
-        lastname = 'Plumbers',
-        accountid = myAccount2.id
-      );
-      insert core;
-      myUser_test = new User(
-        ContactId = core.id,
-        Alias = 'newUser',
-        Email = 'newuser@testorg.com',
-        EmailEncodingKey = 'UTF-8',
-        LastName = 'TestUser',
-        LanguageLocaleKey = 'zh_CN',
-        LocaleSidKey = 'zh_CN',
-        ProfileId = prof.Id,
-        TimeZoneSidKey = 'Asia/Shanghai',
-        UserName = 'testUser@testorg.com',
-        UserPro_Type__c = 'ENG',
-        Work_Location__c = '鍖椾含'
-      );
-      insert myUser_test;
-      myUser_test.UserPro_Type__c = '';
-      update myUser_test;
-    }
-    System.runAs(MyUser_Test) {
-      System.Test.startTest();
-      String accountId = myUser_test.accountid;
-      String agencyProType = myUser_test.UserPro_Type__c;
-      String searchName = '';
-      List<Agency_Hospital_Link__c> ahlInfo = [
-        SELECT Hospital__c, Hospital__r.Name
-        FROM Agency_Hospital_Link__c
-        WHERE Agency__c = :accountId AND Hosptial_Type__c != NULL
-        LIMIT 1
-      ];
-      Set<Id> whoIds = new Set<Id>();
-      for (Agency_Hospital_Link__c ahl : ahlInfo) {
-        whoIds.add(ahl.Hospital__c);
-        if (String.isBlank(searchName)) {
-          searchName = ahl.Hospital__r.Name;
+            Contact core = new Contact(email = 'wan@salesforce.com', firstname = 'wan', lastname = 'Plumbers', accountid = myAccount2.id);
+            insert core;
+            myUser_test = new User(
+                ContactId = core.id,
+                Alias = 'newUser',
+                Email = 'newuser@testorg.com',
+                EmailEncodingKey = 'UTF-8',
+                LastName = 'TestUser',
+                LanguageLocaleKey = 'zh_CN',
+                LocaleSidKey = 'zh_CN',
+                ProfileId = prof.Id,
+                TimeZoneSidKey = 'Asia/Shanghai',
+                UserName = 'testUser@testorg.com',
+                UserPro_Type__c = 'ENG',
+                Work_Location__c = '鍖椾含'
+            );
+            insert myUser_test;
+            myUser_test.UserPro_Type__c = '';
+            update myUser_test;
         }
-      }
-      Map<ID, Account> accInfo = new Map<ID, Account>(
-        [
-          SELECT Id, Name, State_Master__c, State_Master__r.Name
-          FROM Account
-          WHERE Id IN :whoIds
-        ]
-      );
-      Map<String, object> data = new Map<String, object>();
-      data.put('accInfo', accInfo);
-      String ctype = 'ET';
-      lexSearchAgencyHospitalController.init(ctype);
-      lexSearchAgencyHospitalController.serContact(searchName, ctype);
-      System.Test.stopTest();
+        System.runAs(MyUser_Test) {
+            System.Test.startTest();
+            String accountId = myUser_test.accountid;
+            String agencyProType = myUser_test.UserPro_Type__c;
+            String searchName = '';
+            List<Agency_Hospital_Link__c> ahlInfo = [
+                SELECT Hospital__c, Hospital__r.Name
+                FROM Agency_Hospital_Link__c
+                WHERE Agency__c = :accountId AND Hosptial_Type__c != NULL
+                LIMIT 1
+            ];
+            Set<Id> whoIds = new Set<Id>();
+            for (Agency_Hospital_Link__c ahl : ahlInfo) {
+                whoIds.add(ahl.Hospital__c);
+                if (String.isBlank(searchName)) {
+                    searchName = ahl.Hospital__r.Name;
+                }
+            }
+            Map<ID, Account> accInfo = new Map<ID, Account>(
+                [
+                    SELECT Id, Name, State_Master__c, State_Master__r.Name
+                    FROM Account
+                    WHERE Id IN :whoIds
+                ]
+            );
+            Map<String, object> data = new Map<String, object>();
+            data.put('accInfo', accInfo);
+            String ctype = 'ET';
+            lexSearchAgencyHospitalController.init(ctype);
+            lexSearchAgencyHospitalController.serContact(searchName, ctype);
+            System.Test.stopTest();
+        }
     }
-  }
 }

--
Gitblit v1.9.1