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/AgencyOpportunityHandlerTest.cls |   22 +++++++++++++++-------
 1 files changed, 15 insertions(+), 7 deletions(-)

diff --git a/force-app/main/default/classes/AgencyOpportunityHandlerTest.cls b/force-app/main/default/classes/AgencyOpportunityHandlerTest.cls
index 2d9c1e0..423c276 100644
--- a/force-app/main/default/classes/AgencyOpportunityHandlerTest.cls
+++ b/force-app/main/default/classes/AgencyOpportunityHandlerTest.cls
@@ -43,7 +43,8 @@
         List<Account> acclist=[select RecordTypeId,Name 
                                 from Account
                                 ];
-        
+        //System.assertEquals('test1鍖婚櫌',acclist[0].Name);
+        //System.assertEquals(9,acclist.size());
 
         
         account2.Name = 'test1缁忛攢鍟�';
@@ -255,6 +256,8 @@
         insert new List<contact> {contact1,contact2,contact3};
 
         Test.startTest();
+        User thisUser= [select Id from User where Id=:UserInfo.getUserId()];
+        System.runAs (thisUser){
         // 銉︺兗銈躲兗
         //Profile p = [select Id from Profile where Name = '901_缁忛攢鍟嗗懆鎶�'];
         Profile p = [select Id from Profile where Name = '901_缁忛攢鍟嗘椿鍔ㄧ郴缁�'];
@@ -328,7 +331,7 @@
         opp.StageName = '鐩';
         //opp.AgencyOpp_FromOCM__c = true;
         opp.SAP_Send_OK__c = false;
-        opp.CloseDate = Date.newInstance(2222, 7, 15);
+        opp.CloseDate = Date.newInstance(2023, 7, 15);
         insert opp;
         opp.SAP_Send_OK__c = true;
 
@@ -349,7 +352,7 @@
         opp2.Name = 'test璇环2';
         opp2.StageName = '鐩2';
         opp2.SAP_Send_OK__c = false;
-        opp2.CloseDate = Date.newInstance(2222, 7, 15);
+        opp2.CloseDate = Date.newInstance(2023, 7, 15);
         opp2.SAP_Send_OK__c = true;
         
         // Test.startTest();
@@ -369,6 +372,7 @@
                 FROM Agency_Opportunity__Share
                 WHERE ParentId=:agency_opportunity.Id and RowCause <>:rowCause];
         System.assertEquals(user.Id, agencyopportunityShare[0].UserOrGroupId);
+    }
     }
 
     // 缁忛攢鍟嗘墍鏈夎�呫儐銈广儓
@@ -407,7 +411,8 @@
         insert new List<contact> {contact1,contact2,contact3};
         //insert new List<contact> {contact1,contact2};
 
-
+User thisUser= [select Id from User where Id=:UserInfo.getUserId()];
+System.runAs (thisUser){
         // 銉︺兗銈躲兗
         //Profile p = [select Id from Profile where Name = '901_缁忛攢鍟嗗懆鎶�'];
         Profile p = [select Id from Profile where Name = '901_缁忛攢鍟嗘椿鍔ㄧ郴缁�'];
@@ -481,7 +486,7 @@
         opp.StageName = '鐩';
         //opp.AgencyOpp_FromOCM__c = true;
         opp.SAP_Send_OK__c = false;
-        opp.CloseDate = Date.newInstance(2222, 7, 15);
+        opp.CloseDate = Date.newInstance(2023, 7, 15);
         opp.OwnerId = user.Id;
         insert opp;
 
@@ -519,6 +524,7 @@
         System.assertEquals(userList[0].SalesManager__c, aoList[0].Sales_Manager_F__c);
         //System.assertEquals(aoList[0].Sales_Manager_F__c, aoList[0].Sales_Manager__c);
     }
+    }
 
    // 鏅�氭墍鏈夎�呫儐銈广儓
     @isTest
@@ -548,7 +554,8 @@
         contact3.FirstName = '璨换鑰�';
         contact3.LastName = 'test2缁忛攢鍟�';
         insert new List<contact> {contact1,contact2,contact3};
-
+User thisUser= [select Id from User where Id=:UserInfo.getUserId()];
+System.runAs (thisUser){
         // 銉︺兗銈躲兗
         //Profile p = [select Id from Profile where Name = '901_缁忛攢鍟嗗懆鎶�'];
         Profile p = [select Id from Profile where Name = '901_缁忛攢鍟嗘椿鍔ㄧ郴缁�'];
@@ -632,7 +639,7 @@
         opp.StageName = '鐩';
         //opp.AgencyOpp_FromOCM__c = true;
         opp.SAP_Send_OK__c = false;
-        opp.CloseDate = Date.newInstance(2222, 7, 15);
+        opp.CloseDate = Date.newInstance(2023, 7, 15);
         opp.OwnerId = user3.Id;
         insert opp;
 
@@ -678,6 +685,7 @@
         System.assertEquals(userList[0].SalesManager__c, aoList[0].Sales_Manager_F__c);
         //System.assertEquals(aoList[0].Sales_Manager_F__c, aoList[0].Sales_Manager__c);
     }
+    }
 
     public static void makeNormalData(boolean withAgencyDetail) {
         ControllerUtil.EscapeNFM001Trigger = true;

--
Gitblit v1.9.1