涂煌豪
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
@isTest
private class NFM116BatchTest {
    @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.salesManageConfirmDate__c  = Date.today().addDays(-1);
        es.HPSignUpStatus__c = '已批准';
        es.HPSignUpDate__c = Date.today().addDays(-1);
        es.HPConfirmDate__c = Date.today().addDays(-1);
        es.end_User__c = '契約';
        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(){
        Test.startTest();
        Database.executeBatch(new NFM116Batch(), 200);
        Test.stopTest();
    }
    static testMethod void testMethod2(){
        Test.startTest();
        Database.executeBatch(new NFM116Batch(Date.today()), 200);
        Test.stopTest();
    }
    static testMethod void testMethod3(){
        Test.startTest();
        Database.executeBatch(new NFM116Batch(Date.today().addDays(-30), true), 200);
        Test.stopTest();
    }
    static testMethod void testMethod4(){
        Test.startTest();
        eSignForm__c es = [select Id from eSignForm__c];
        Database.executeBatch(new NFM116Batch(es.Id), 200);
        Test.stopTest();
    }
    static testMethod void testMethod5(){
        Test.startTest();
        eSignForm__c es = [select Id from eSignForm__c];
        Database.executeBatch(new NFM116Batch(new List<String>{es.id}), 200);
        Test.stopTest();
    }
}