buli
2022-05-13 2f4492ee18f90274582fcc2bb06f5e9bf64136e8
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
@isTest
private class LicenseCheckUtilTest {
    static testMethod void testMethod1() {
        List<RecordType> rectIE = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = 'Customer IE'];
        Account acc1 = new Account(
            name = '*',
            RecordTypeId = rectIE[0].Id,
            OwnerId = UserInfo.getUserId(),
            DivisionName__c = 'Customer IE',
            FacilityName__c = 'abc',
            DivisionName_D__c = 'Customer IE',
            FacilityNameD__c = 'abc',
            AccountStatus__c = 'Cancel',
            PostCode__c = '123456'
        );
        insert acc1;
        License_Information__c li = new License_Information__c(
            name = 'test',
            LicenseType__c = '辐射安全许可证',
            ValidFrom__c = Date.today().addDays(-5),
            LicenseAndAccount__c = acc1.Id,
            ValidTo__c = Date.today().addDays(4)
        );
        insert li;
        LicenseCheckUtil.LicenseCheck1(acc1.Id);
        LicenseCheckUtil.LicenseCheck1('111');
        li.ValidTo__c = Date.today().addDays(-3);
        update li;
        LicenseCheckUtil.LicenseCheck1(acc1.Id);
 
    }
 
    static testMethod void testMethod2() {
        List<RecordType> rectIE = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = 'Customer IE'];
        Account acc1 = new Account(
            name = '*',
            RecordTypeId = rectIE[0].Id,
            OwnerId = UserInfo.getUserId(),
            DivisionName__c = 'Customer IE',
            FacilityName__c = 'abc',
            DivisionName_D__c = 'Customer IE',
            FacilityNameD__c = 'abc',
            AccountStatus__c = 'Cancel',
            PostCode__c = '123456'
        );
        insert acc1;
        License_Information__c li = new License_Information__c(
            name = 'test',
            LicenseType__c = '第二类医疗器械经营备案凭证',
            ValidFrom__c = Date.today().addDays(-5),
            LicenseAndAccount__c = acc1.Id,
            StorageAddress__c = '1111',
            ValidTo__c = Date.today().addDays(4)
        );
        insert li;
        LicenseCheckUtil.AddressCheck(acc1.Id,'1111');
        LicenseCheckUtil.AddressCheck(acc1.Id,'111111');
    }
 
     static testMethod void testMethod3() {
        List<RecordType> rectIE = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = 'Customer IE'];
        Account acc1 = new Account(
            name = '*',
            RecordTypeId = rectIE[0].Id,
            OwnerId = UserInfo.getUserId(),
            DivisionName__c = 'Customer IE',
            FacilityName__c = 'abc',
            DivisionName_D__c = 'Customer IE',
            FacilityNameD__c = 'abc',
            AccountStatus__c = 'Cancel',
            PostCode__c = '123456'
        );
        insert acc1;
        License_Information__c li = new License_Information__c(
            name = 'test',
            LicenseType__c = '第二类医疗器械经营备案凭证',
            ValidFrom__c = Date.today().addDays(-5),
            LicenseAndAccount__c = acc1.Id,
            StorageAddress__c = '1111',
            ValidTo__c = Date.today().addDays(4)
        );
        insert li;
 
        License_Information__c li1 = new License_Information__c(
            name = 'test',
            LicenseType__c = '营业执照',
            ValidFrom__c = Date.today().addDays(-5),
            LicenseAndAccount__c = acc1.Id,
            StorageAddress__c = '1111',
            ValidTo__c = Date.today().addDays(4)
        );
        insert li1;
 
        LicenseCheckUtil.LicenseCheck(acc1.Id);
    }
}