@isTest
public with sharing class ProRegisterLinkHandlerTest {

	static testMethod void AfterInsert() {
		Product_Register__c prorec = new Product_Register__c();
		prorec.Name = 'SFDCTEST2018001';
		prorec.MedPrdClass__c = '3';
		prorec.RegisterNoClass_New__c = '';
		prorec.RegisterNoClass_Old__c = '6822';
		prorec.PrdCompanyAddr__c = '名称:奥林巴斯医疗株式会社;住所:日本国东京都涩谷区幡之谷二丁目43番地2号;联系方式:0081-426-42-2667';
		prorec.ValidTo__c = Date.today().addDays(22);
		prorec.ValidFrom__c = Date.today().addDays(-22);
		insert prorec;

		Product2 product2 = new Product2();
		product2.Name = 'WD18100A';
		insert product2;

		Product2 pro = new Product2();
		pro.Name = 'A00507A:密封圈,  透明, 黑色';
		insert pro;

		Product_Register_Link__c prl = new Product_Register_Link__c(Product_Register__c = prorec.ID);
		prl.Product2__c = pro.ID;
		insert prl;

		System.Test.startTest();
		Product_Register_Link__c prl001 = new Product_Register_Link__c(Product_Register__c = prorec.ID);
		prl001.Product2__c = pro.ID;
		insert prl001;

		System.Test.stopTest();
	}

	static testMethod void AfterUpdate() {
		Product_Register__c prorec = new Product_Register__c();
		prorec.Name = 'SFDCTEST2018001';
		prorec.MedPrdClass__c = '3';
		prorec.RegisterNoClass_New__c = '';
		prorec.RegisterNoClass_Old__c = '6822';
		prorec.PrdCompanyAddr__c = '名称:奥林巴斯医疗株式会社;住所:日本国东京都涩谷区幡之谷二丁目43番地2号;联系方式:0081-426-42-2667';
		prorec.ValidTo__c = Date.today().addDays(22);
		prorec.ValidFrom__c = Date.today().addDays(-22);
		insert prorec;

		Product2 product2 = new Product2();
		product2.Name = 'WD18100A';
		insert product2;

		Product2 pro = new Product2();
		pro.Name = 'A00507A:密封圈,  透明, 黑色';
		insert pro;

		Product_Register_Link__c prl = new Product_Register_Link__c(Product_Register__c = prorec.ID);
		prl.Product2__c = pro.ID;
		insert prl;

		System.Test.startTest();
		Product_Register_Link__c prl001 = new Product_Register_Link__c(Product_Register__c = prorec.ID);
		prl001.Product2__c = pro.ID;
		insert prl001;
		update prl001;
		System.Test.stopTest();
	}

	static testMethod void AfterDelete() {
		Product_Register__c prorec = new Product_Register__c();
		prorec.Name = 'SFDCTEST2018001';
		prorec.MedPrdClass__c = '3';
		prorec.RegisterNoClass_New__c = '';
		prorec.RegisterNoClass_Old__c = '6822';
		prorec.PrdCompanyAddr__c = '名称:奥林巴斯医疗株式会社;住所:日本国东京都涩谷区幡之谷二丁目43番地2号;联系方式:0081-426-42-2667';
		prorec.ValidTo__c = Date.today().addDays(22);
		prorec.ValidFrom__c = Date.today().addDays(-22);
		insert prorec;


		Product2 product2 = new Product2();
		product2.Name = 'WD18100A';
		insert product2;


		Product2 pro = new Product2();
		pro.Name = 'A00507A:密封圈,  透明, 黑色';
		insert pro;
		Product_Register_Link__c prl = new Product_Register_Link__c(Product_Register__c = prorec.ID);
		prl.Product2__c = pro.ID;
		insert prl;

		System.Test.startTest();
		Product_Register_Link__c prl001 = new Product_Register_Link__c(Product_Register__c = prorec.ID);
		prl001.Product2__c =  pro.ID;
		insert prl001;
		delete prl001;
		System.Test.stopTest();
	}
}