高章伟
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
@isTest
private class InvocableUtilTest {
 
    static ConsumTestDataFactory factory;
    @testSetup static void setupTestData(){
        factory = new ConsumTestDataFactory();
        factory.setupTestData();
        factory.selectDetails(2);
    }
 
    @isTest
    static void testMethond1() {
        Consum_Apply__c ca = [SELECT Id FROM Consum_Apply__c LIMIT 1];
        List<Consum_Apply_Equipment_Set_Detail__c> caesdList = [SELECT Id
                                                                 FROM Consum_Apply_Equipment_Set_Detail__c
                                                                 WHERE Consum_Apply__c =: ca.Id];
        System.assertEquals(2, caesdList.size());
        List<InvocableUtil.LoggingRequest> lList = new List<InvocableUtil.LoggingRequest>();
        InvocableUtil.LoggingRequest l = new InvocableUtil.LoggingRequest();
        l.objId = ca.Id;
        lList.add(l);
        InvocableUtil.createLog(lList);
        caesdList = [SELECT Id
                       FROM Consum_Apply_Equipment_Set_Detail__c
                       WHERE Consum_Apply__c =: ca.Id];
        System.assertEquals(0, caesdList.size());
    }
}