高章伟
2023-03-02 e3c02c03dd2de442bbced87236f60a13a1cd154e
force-app/main/default/classes/AgencyOpportunityHandlerTest.cls
@@ -256,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_经销商活动系统'];
@@ -329,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;
@@ -350,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();
@@ -370,6 +372,7 @@
                FROM Agency_Opportunity__Share
                WHERE ParentId=:agency_opportunity.Id and RowCause <>:rowCause];
        System.assertEquals(user.Id, agencyopportunityShare[0].UserOrGroupId);
    }
    }
    // 经销商所有者テスト
@@ -408,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_经销商活动系统'];
@@ -482,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;
@@ -520,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
@@ -549,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_经销商活动系统'];
@@ -633,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;
@@ -679,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;