涂煌豪
2022-05-16 d075f9ef422d029599749fcf65c44740dbe4d8f9
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
@isTest
private class NFM116ControllerTest {
    @TestSetup
    static void makeData(){
        Opportunity opp = new Opportunity();
        opp.Opportunity_No__c = 'XB-153P-06-S151289';
        opp.Opportunity_Category__c = 'ET';
        opp.StageName = '目標';
        opp.Authorized_DB_No__c = 'XB-153P-06-S151289';
        opp.Name = '::XB-153P-06-S151289';
        opp.Close_Forecasted_Date__c = Date.today();
        opp.CloseDate = Date.today();
        opp.Opp_Confirmation_Day__c = Date.today();
        insert opp;
        
        Statu_Achievements__c Statu1 = new Statu_Achievements__c();
        Statu1.ContractNO__c = 'SH-ET-191025';
        Statu1.Opportunity__c = opp.Id;
        Statu1.ContractAmount__c = 100;
        insert Statu1;
 
        eSignForm__c es = new eSignForm__c();
        es.Statu_Achievements__c = Statu1.Id;
        es.DNName__c = '11223344';
        es.agencyAutoSignUpStatus__c = '已批准';
        es.agencySignUpDate__c = Date.today().addDays(-1);
        es.agencyConfirmDate__c = Date.today().addDays(-1);
        es.HPSignUpStatus__c = '已批准';
        es.HPSignUpDate__c = Date.today().addDays(-1);
        es.HPConfirmDate__c = Date.today().addDays(-1);
        insert es;
 
        eSignFormLineItem__c esi = new eSignFormLineItem__c();
        esi.Count__c = 2;
        esi.agencyGoodStatus__c = '完好';
        esi.eSignForm__c = es.Id;
        insert esi;
        eSignFormLineItem__c esi2 = new eSignFormLineItem__c();
        esi2.Count__c = 2;
        esi2.agencyGoodStatus__c = '完好';
        esi2.eSignForm__c = es.Id;
        insert esi2;
    }
 
    static testMethod void testMethod1() {
        List<eSignForm__c> eSignFormList = [select id from eSignForm__c];
        List<String> eSignFormIdList = new List<String>();
        for(eSignForm__c es : eSignFormList){
            eSignFormIdList.add(es.Id);
        }
        BatchIF_Log__c iflog = new BatchIF_Log__c();
        iflog.Log__c = 'test start \n';
        insert iflog;
        Test.startTest();
        NFM116Controller.callout(iflog.Id, eSignFormIdList);
        Test.stopTest();
    }
}