@isTest
|
private class IsValidLicenseBatchTest {
|
|
static testMethod void testMonitoring() {
|
|
List<RecordType> rectCo = [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(2018, 05, 22);
|
lic.Scope3__c = '6815;6822;6823;6825';
|
lic.IsInquire__c = false ;
|
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(2018, 05, 22);
|
lic.IsInquire__c = false ;
|
lic1.Scope__c = '6815;6822;6823;6825';
|
lic1.LicenseAndAccount__c = myAccount1.Id;
|
insert lic1;
|
List<License_Information__c> liList= [select Id,Name,IsInquire__c from License_Information__c
|
where Is_Active_Formula__c = false
|
AND IsInquire__c = false];
|
System.assertEquals(2, liList.size());
|
Test.startTest();
|
Id execBTId = Database.executeBatch(new IsValidLicenseBatch());
|
Test.stopTest();
|
}
|
|
}
|