@isTest
|
public class LicenseInfoHandlerTest {
|
static testMethod void testMonitoring() {
|
List<RecordType> conOrder_Order = [select Id from RecordType where IsActive = true and SobjectType = 'Consumable_order__c' and Name = '01 订单'];
|
if (conOrder_Order.size() == 0) {
|
return;
|
}
|
|
List<RecordType> conOrderDetail_Order = [select Id from RecordType where IsActive = true and SobjectType = 'Consumable_orderdetails__c' and Name = '订单'];
|
if (conOrderDetail_Order.size() == 0) {
|
return;
|
}
|
|
List<RecordType> rectCo = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '販売店'];
|
if (rectCo.size() == 0) {
|
return;
|
}
|
|
List<RecordType> rectContract = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '契約'];
|
if (rectCo.size() == 0) {
|
return;
|
}
|
Account myAccount1 = new Account(name='Testaccount001',
|
Dealer_discount__c =20,
|
Ban_On_Use_Date__c = Date.today().addDays(1),
|
Business_Paper_Expiration_Date__c = Date.today().addDays(1),
|
Tax_Practice_Expiration_Date__c = Date.today().addDays(1),
|
Medical_Equipment_Expiration_Date__c = Date.today().addDays(1),
|
RecordTypeId = rectCo[0].Id);
|
insert myAccount1;
|
|
License_Information__c lic = new License_Information__c();
|
lic.name='Test20181204';
|
lic.LicenseType__c = '医疗器械经营许可证';
|
lic.BusinessLicense__c = '20180522';
|
lic.ValidFrom__c = date.newinstance(2018, 05, 22);
|
lic.ValidTo__c = date.newinstance(2088, 05, 22);
|
lic.Scope3__c = '6815;6822;6823;6825';
|
lic.LicenseAndAccount__c = myAccount1.Id;
|
insert lic;
|
License_Information__c lic1 = new License_Information__c();
|
lic1.name='Test20190111';
|
lic1.LicenseType__c = '第二类医疗器械经营备案凭证';
|
lic1.BusinessLicense__c = '20190522';
|
lic1.ValidFrom__c = date.newinstance(2018, 05, 22);
|
lic1.ValidTo__c = date.newinstance(2088, 05, 22);
|
lic1.Scope__c = '6815;6822;6823;6825';
|
lic1.LicenseAndAccount__c = myAccount1.Id;
|
insert lic1;
|
Test.startTest();
|
lic.name='20181204';
|
lic.Scope3__c = '';
|
lic.BusinessLicense__c = '20180522';
|
update lic;
|
lic1.Scope__c = '6816;6826;6827;6828';
|
update lic1;
|
Test.stopTest();
|
}
|
}
|