From b4dff1ab265d1f2b3c6fd5540fddadd7a0f8db7e Mon Sep 17 00:00:00 2001
From: GWY <guweiyiscp096@foxmail.com>
Date: 星期五, 08 四月 2022 09:49:08 +0800
Subject: [PATCH] no message

---
 force-app/main/default/classes/ContactTriggerHandlerTest.cls |  162 ++++++++++++++++++++++++++++--------------------------
 1 files changed, 84 insertions(+), 78 deletions(-)

diff --git a/force-app/main/default/classes/ContactTriggerHandlerTest.cls b/force-app/main/default/classes/ContactTriggerHandlerTest.cls
index ef501c9..37dfd9f 100644
--- a/force-app/main/default/classes/ContactTriggerHandlerTest.cls
+++ b/force-app/main/default/classes/ContactTriggerHandlerTest.cls
@@ -1,84 +1,90 @@
 @isTest
 private class ContactTriggerHandlerTest {
 
-	public static Account account1 = new Account();
-    public static Account account2 = new Account();
-    public static Contact contact1 = new Contact();
-    public static Contact contact2 = new Contact();
-	
-	@isTest static void test_method_one() {
-		// 鍙栧紩鍏�
-        account1.Name = 'test1鍖婚櫌';
-        account1.RecordTypeId = '01210000000QemG';
-        insert account1;
+    static testMethod void myUnitTest() {
+        List<RecordType> rectIE = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = 'Customer IE'];
         
-        // 鍙栧紩鍏堣铂浠昏��
-        contact1.AccountId = account1.Id;
-        contact1.FirstName = '璨换鑰�';
-        contact1.LastName = 'test1鍖婚櫌';
-        Account dept = [select Id from Account where RecordTypeId = '01210000000QemL'];
-        contact1.Strategic_dept_Class__c = dept.Id;
-        contact1.MobilePhone = '13409507069';
-        contact1.RecordTypeId = '01210000000QfWdAAK';
-        contact1.UnifiedI_Contact_ID__c = '100000';
-        insert contact1;
-        MeetingManagement__c a = 
-        new MeetingManagement__c(Contact__c =contact1.id
-            ,pollingTime__c = 1,
-            VisitTime__c= 1,InspectTime__c =1,
-            InspectEquipmentTime__c = 1,TeachingTime__c =1 ,
-            MaintenanceReportTime__c =1
-         );
-        insert a;
-        update contact1;
-        List<Agency_Contact__c> agency_contact = [Select Id, Name,Contact__c from Agency_Contact__c];
-
-        System.assertEquals(agency_contact.size(), 1);
-        System.assertEquals(agency_contact[0].Contact__c, contact1.Id);
-
-        delete contact1;
-
-        agency_contact = [Select Id, Name from Agency_Contact__c];
-
-        System.assertEquals(agency_contact.size(), 0);
-	}
-	@isTest
-    static void test_method_two(){
-        account2.Name = 'test2 缁忛攢鍟�';
-        account2.RecordTypeId = '01210000000Qem1';
-        insert account2;
-
-        contact2.FirstName = 'test';
-        contact2.LastName = 'Data';
-        contact2.RecordTypeId = '01210000000QfWi';
-        contact2.AccountId = account2.Id;
-        contact2.Agency_User__c = true;
-        contact2.MobilePhone = '18999999999';
-        insert contact2;
-        contact2.MobilePhone = '1899999999A';
-        update contact2; 
-
-        Contact contact3 = new Contact();
-        contact3.FirstName = 'test';
-        contact3.LastName = 'Data';
-        contact3.RecordTypeId = '01210000000QfWi';
-        contact3.AccountId = account2.Id;
-        // contact3.Agency_User__c = true;
-        contact3.Ignore_Same_Name__c = true;
-        contact3.MobilePhone = '';
-        insert contact3;
-        List<account> accList  = [select Dealer_Num__c From account];
-        system.assertEquals(accList[0].Dealer_Num__c,1);
-
-        contact2.Agency_User__c = false;
-        update contact2;
-        List<account> accList2  = [select Dealer_Num__c From account];
-        system.assertEquals(accList2[0].Dealer_Num__c,0);
-
-        contact2.Agency_User__c = true;
-        update contact2;
-        delete contact2;
-        List<account> accList3  =  [select Dealer_Num__c From account];
-        system.assertEquals(accList3[0].Dealer_Num__c,0);
+        User user = new User();
+        user.LastName = 'test02';
+        user.FirstName = 'test';
+        user.Alias = 'test02';
+        user.Email = 'test@test02.com';
+        user.Username = 'test111@test3222.com';
+        user.CommunityNickname = 'test1111';
+        user.IsActive = true;
+        user.EmailEncodingKey = 'ISO-2022-JP';
+        user.TimeZoneSidKey = 'Asia/Tokyo';
+        user.LocaleSidKey = 'ja_JP';
+        user.LanguageLocaleKey = 'ja';
+        user.ProfileId = System.Label.SystemAdmin;
+        insert user;
+        
+        Account acc = new Account();
+        acc.Name = '*';
+        acc.DivisionName__c = 'DivisionName__c';
+        acc.FacilityName__c = 'FacilityName__c';
+        acc.PostCode__c='000000';
+        acc.stautesD__c= 'Pass';
+        insert acc;
+        
+        Contact con = new Contact();
+        con.LastName = 'test';
+        con.AccountId = acc.Id;
+        con.MobilePhone = 'MobilePhoneD__c';
+        con.OtherPhone = 'OtherPhoneD__c';
+        con.Fax = 'FaxD__c';
+        con.Email = 'EmailD__c@test.com';
+        con.Phone = 'PhoneD__c';
+        con.Title = 'TitleD__c';
+        con.Address1__c = 'Address1D__c';
+        con.Address2__c = 'Address2D__c';
+        con.Address3__c = 'Address3D__c';
+        con.Postcode__c = '100111';
+        con.ContactStatus__c = 'ContactStatusD__c';
+        con.CancelReason__c = 'CancelReasonD__c';
+        con.StatusD__c = 'Pass';
+        
+        insert con;
+        
+        con.MobilePhone = 'MobilePhone';
+        con.OtherPhone = 'OtherPhone';
+        con.Fax = 'Fax';
+        con.Email = 'Email@test.com';
+        con.Phone = 'Phone';
+        con.Title = 'Title';
+        con.Address1__c = 'Address1__c';
+        con.Address2__c = 'Address2__c';
+        con.Address3__c = 'Address3__c';
+        con.Postcode__c = '100222';
+        con.ContactStatus__c = 'ContactStatus__c';
+        con.CancelReason__c = 'CancelReason__c';
+        
+        update con;
+        
+        con.MobilePhoneD__c = 'MobilePhoneD__c';
+        con.OtherPhoneD__c = 'OtherPhoneD__c';
+        con.FaxD__c = 'FaxD__c';
+        con.EmailD__c = 'EmailD__c@test.com';
+        con.PhoneD__c = 'PhoneD__c';
+        con.TitleD__c = 'TitleD__c';
+        con.Address1D__c = 'Address1D__c';
+        con.Address2D__c = 'Address2D__c';
+        con.Address3D__c = 'Address3D__c';
+        con.PostcodeD__c = '100111';
+        con.ContactStatusD__c = 'ContactStatusD__c';
+        con.CancelReasonD__c = 'CancelReasonD__c';
+        
+        update con;
+        
+        con.StatusD__c = 'Completed';
+        update con;
+        con.StatusD__c = 'Submit';
+        update con;
+        con.StatusD__c = 'Pass';
+        update con;
+        
+        con.StatusD__c = 'Reject';
+        update con;
+        
     }
 }
\ No newline at end of file

--
Gitblit v1.9.1