高章伟
2022-02-24 2aa8da8af66aa8ae00f25831aed6bb0364176e7b
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 ConsumApplyEquipmentSetSRListCtrlTest {
    static ConsumTestDataFactory factory;
    // 造出选择完明细的申请
    @testSetup static void setupTestData(){
        factory = new ConsumTestDataFactory();
        factory.setupTestData();
    }
 
    static testMethod void testInit() {
        Consum_Apply__c ca = [SELECT Id FROM Consum_Apply__c LIMIT 1];
        System_UserSetting__c config = System_UserSetting__c.getInstance(UserInfo.getUserId());
        System.assertEquals(null, config.CAESD_Action_Type__c);
 
        PageReference ref = new PageReference('/apex/ConsumApplyEquipmentSetSRList?id=' + ca.Id);
        Test.setCurrentPage(ref);
        ConsumApplyEquipmentSetSRListController controller = new ConsumApplyEquipmentSetSRListController();
        Test.startTest();
        controller.init();
        controller.selectedType = '发货';
        controller.setType();
        Test.stopTest();
 
        config = System_UserSetting__c.getInstance(UserInfo.getUserId());
        System.assertEquals('发货', config.CAESD_Action_Type__c);
 
    }
}