@isTest
|
private class ProductLimitControllerTest {
|
|
static Product2__c pro1;
|
|
@isTest
|
static void test1(){
|
ProductLimitController.category1 = 'ENG';
|
ProductLimitController.category2 = '耗材';
|
ProductLimitController.category3 = '腹腔镜手术';
|
ProductLimitController.category4 = '超声刀刀头(对手)';
|
Product2 prod01 = new Product2(Name='Test01');
|
prod01.ProductCode='Test01';
|
prod01.Asset_Model_No__c = 'Test01';
|
prod01.SFDA_Status__c = '有効';
|
prod01.Dealer_special_Object__c = true;
|
prod01.Family = 'GI';
|
prod01.Category2__c = '耗材';
|
prod01.Category3__c = '其他';
|
prod01.Category4__c = '其他';
|
prod01.Category5__c = '其他';
|
insert new Product2[]{prod01};
|
pro1 = new Product2__c(
|
Name='Pro001',
|
Category1_text__c = 'ENG',
|
Category2_text__c = '耗材',
|
Category3_text__c = '腹腔镜手术',
|
Category4_text__c = '超声刀刀头(对手)',
|
OT_CODE_Text__c = 'Test001',
|
Product2__c = prod01.Id);
|
insert new Product2__c[] {pro1};
|
List<RecordType> rectCo = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '販売店'];
|
List<RecordType> rectCo1 = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and DeveloperName = 'AgencyContract'];
|
Account myAccount1 = new Account(name='Testaccount001',Dealer_discount__c =10,RecordTypeId = rectCo[0].Id,AgentCode_Ext__c = '8888888',Product_Limit_Date__c = 'Test07|3|100,Test08|10|50');
|
insert myAccount1;
|
Account contract = new Account(RecordTypeId=rectCo1[0].Id ,Name ='contractName',ParentId = myAccount1.id,Agent_Ref__c =myAccount1.id, Contract_Department_Class__c = 'ET',Contract_Decide_Start_Date__c=Date.today().addDays(-2),
|
Contract_Decide_End_Date__c = Date.today().addDays(2),Dealer_discount__c = 0.8);
|
insert contract;
|
Test.StartTest();
|
ProductLimitController.initCategory();
|
ProductLimitController.category1Change('ENG');
|
ProductLimitController.category2Change('ENG', '耗材');
|
ProductLimitController.category3Change('ENG', '耗材', '腹腔镜手术');
|
ProductLimitController.searchAllProduct();
|
// ProductLimitController.searchProduct();
|
// ProductLimitController.searchProductByCategoryList();
|
// ProductLimitController.readCsvFile();
|
// ProductLimitController.importSave();
|
Test.stopTest();
|
}
|
}
|