高章伟
2022-02-18 8b5f4c6c281cfa548f92de52c8021e37aa81901e
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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
@isTest(SeeAllData=false)
private class SetCurrentDailyReportSumTest {
 
   
 
    static testMethod void  test_method_schedule() {
        // Implement test code
        Daily_Report__c dr = new Daily_Report__c();
        dr.Reported_Date__c = Date.today();
        dr.Reporter__c = UserInfo.getUserId();
        dr.Status__c = '申請中';
        insert dr;
 
        String CRON_EXP = '0 0 0 3 9 ? 2032';
        system.schedule('SetCurrentDailyReportSumTest', CRON_EXP, new SetCurrentDailyReportSumSchedule());
    }
 
    static testMethod void  test_method_one() {
        // Implement test code
        Daily_Report__c dr = new Daily_Report__c();
        dr.Reported_Date__c = Date.newInstance(Date.today().year()-1, 9, 1);
        dr.Reporter__c = UserInfo.getUserId();
        dr.Status__c = '申請中';
        insert dr;
 
        Id execBTId = Database.executeBatch(new SetCurrentDailyReportSumBatch(Date.newInstance(Date.today().year()-1, 10, 1), UserInfo.getUserId()), 20);
    }
 
    static testMethod void  test_method_two() {
        // Implement test code
        Daily_Report__c dr = new Daily_Report__c();
        dr.Reported_Date__c = Date.newInstance(Date.today().year()-1, 9, 1);
        dr.Reporter__c = UserInfo.getUserId();
        dr.Status__c = '申請中';
        insert dr;
 
        Id execBTId = Database.executeBatch(new SetCurrentDailyReportSumBatch(Date.newInstance(Date.today().year(), 3, 1), UserInfo.getUserId()), 20);
    }
 
    static testMethod void  test_method_three() {
        // Implement test code
        Daily_Report__c dr = new Daily_Report__c();
        dr.Reported_Date__c = Date.newInstance(Date.today().year()-1, 7, 1);
        dr.Reporter__c = UserInfo.getUserId();
        dr.Status__c = '申請中';
        insert dr;
         Test.startTest();
        Id execBTId = Database.executeBatch(new SetCurrentDailyReportSumBatch(Date.newInstance(Date.today().year()+1, 4, 1), UserInfo.getUserId()), 20);
        Test.stopTest();
    }
    @isTest
    PUBLIC static void  test_method_four() {
        StaticParameter.EventOpportunityPileUpExeFlg = true;
    // EventC⇒Event処理後、逆更新をスルー用
    StaticParameter.NotUpdEventCFlg = true;
    // 積み上げ処理後、トリガをスルー用
    StaticParameter.EscapeNFM001Trigger = true;
    StaticParameter.EscapeNFM001AgencyContractTrigger = true;
    StaticParameter.EscapeNFM001AgencyContractTrigger2 = true;
    StaticParameter.EscapeNFM007Trigger = true;
    StaticParameter.EscapeOpportunityBefUpdTrigger = true;
    StaticParameter.EscapeOpportunityHpDeptUpdTrigger = true;
    StaticParameter.EscapeSyncOpportunityTrigger = true;
    StaticParameter.EscapeMaintenanceContractAfterUpdateTrigger = true;
    StaticParameter.EscapeSyncProduct2Trigger = true;
    // trueのとき、リードのトリガーをスルーする
    StaticParameter.EscapeLeadTrigger = true;
    StaticParameter.EscapeAccountTrigger = true;
 
    StaticParameter.EscapeConsumableOrderDetail2Trigger = true;
 
    StaticParameter.EscapeNFM010UpsertStatuAchievementsTrigger = true;
    // 直销耗材不直销 ConsumableAssetHander
    StaticParameter.ConsumableAssetHanderTrigger = true;
 
    // 跳过不涉及备品借出的逻辑
    StaticParameter.rentalApplyIsRunning = true;
 
    // accountdailyUpdate 跳过 更新询价
    StaticParameter.EscapeOpportunityownerUpdate  = true;
        // Implement test code
       // Daily_Report__c dr = new Daily_Report__c();
       //  dr.Reported_Date__c = Date.newInstance(Date.today().year()-1, 7, 1);
       //  dr.Reporter__c = UserInfo.getUserId();
       //  dr.Status__c = '申請中';
       //  insert dr;
 
        Test.startTest();
        Id execBTId = Database.executeBatch(new SetCurrentDailyReportSumBatch(152,UserInfo.getUserId()),1);
        Test.stopTest();
 
 
    }
     @isTest
    PUBLIC static void  test_method_five() {
        StaticParameter.EventOpportunityPileUpExeFlg = true;
    // EventC⇒Event処理後、逆更新をスルー用
    StaticParameter.NotUpdEventCFlg = true;
    // 積み上げ処理後、トリガをスルー用
    StaticParameter.EscapeNFM001Trigger = true;
    StaticParameter.EscapeNFM001AgencyContractTrigger = true;
    StaticParameter.EscapeNFM001AgencyContractTrigger2 = true;
    StaticParameter.EscapeNFM007Trigger = true;
    StaticParameter.EscapeOpportunityBefUpdTrigger = true;
    StaticParameter.EscapeOpportunityHpDeptUpdTrigger = true;
    StaticParameter.EscapeSyncOpportunityTrigger = true;
    StaticParameter.EscapeMaintenanceContractAfterUpdateTrigger = true;
    StaticParameter.EscapeSyncProduct2Trigger = true;
    // trueのとき、リードのトリガーをスルーする
    StaticParameter.EscapeLeadTrigger = true;
    StaticParameter.EscapeAccountTrigger = true;
 
    StaticParameter.EscapeConsumableOrderDetail2Trigger = true;
 
    StaticParameter.EscapeNFM010UpsertStatuAchievementsTrigger = true;
    // 直销耗材不直销 ConsumableAssetHander
    StaticParameter.ConsumableAssetHanderTrigger = true;
 
    // 跳过不涉及备品借出的逻辑
    StaticParameter.rentalApplyIsRunning = true;
 
    // accountdailyUpdate 跳过 更新询价
    StaticParameter.EscapeOpportunityownerUpdate  = true;
        // Implement test code
       // Daily_Report__c dr = new Daily_Report__c();
       //  dr.Reported_Date__c = Date.newInstance(Date.today().year()-1, 7, 1);
       //  dr.Reporter__c = UserInfo.getUserId();
       //  dr.Status__c = '申請中';
       //  insert dr;
 
        Test.startTest();
        Id execBTId = Database.executeBatch(new SetCurrentDailyReportSumBatch(UserInfo.getUserId()),1);
 
        Test.stopTest();
 
 
    }
 
    
}