@isTest
|
private class OpportunityBiddingHandlerTest {
|
@isTest
|
static void testMethod1() {
|
List<RecordType> rectCo = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '病院'];
|
if (rectCo.size() == 0) {
|
return;
|
}
|
List<RecordType> rectSct = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '戦略科室分類 呼吸科'];
|
if (rectSct.size() == 0) {
|
return;
|
}
|
List<RecordType> rectDpt = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '診療科 消化科'];
|
if (rectDpt.size() == 0) {
|
return;
|
}
|
// テストデータ
|
Account company = new Account();
|
company.RecordTypeId = rectCo[0].Id;
|
company.Name = 'NFM007TestCompany';
|
upsert company;
|
Account section = new Account();
|
section.RecordTypeId = rectSct[0].Id;
|
section.Name = '*';
|
section.Department_Class_Label__c = '消化科';
|
section.ParentId = company.Id;
|
section.Hospital_Department_Class__c = company.Id;
|
upsert section;
|
Account depart = new Account();
|
depart.RecordTypeId = rectDpt[0].Id;
|
depart.Name = '*';
|
depart.Department_Name__c = 'NFM007TestDepart';
|
depart.ParentId = section.Id;
|
depart.Department_Class__c = section.Id;
|
depart.Hospital__c = company.Id;
|
upsert depart;
|
|
Opportunity opp = new Opportunity();
|
opp.AccountId = depart.Id;
|
opp.Department_Class__c = section.Id;
|
opp.Hospital__c = company.Id;
|
opp.SAP_Send_OK__c = false;
|
opp.Name = 'GZ-SP-NFM007_1';
|
opp.Trade__c = '内貿';
|
opp.StageName = '引合';
|
opp.CloseDate = date.newinstance(2022, 11, 30);
|
opp.Stock_apply_status__c = '申请中';
|
opp.Whether_Bidding__c = '否';
|
// opp.OCM_man_province__c = '河南';
|
insert opp;
|
|
Enquiry_No_Bidding_Apply__c enb = new Enquiry_No_Bidding_Apply__c();
|
// enb.Name = 'EnbTest01';
|
enb.NotBidApprovalStatus__c = '申请中';
|
enb.Opportunity__c = opp.Id;
|
insert enb;
|
enb.NotBidApprovalStatus__c = '批准';
|
update enb;
|
|
}
|
}
|