@isTest
|
private class ConsumSelectControllerTest {
|
|
static testMethod void testUnAssign() {
|
Oly_TriggerHandler.bypass('ConsumApplyTriggerHandler');
|
//Oly_TriggerHandler.bypass('ConsumApplyEquipmentSetDetailHandler');
|
Oly_TriggerHandler.bypass('ConsumApplyEquipmentSetHandler');
|
FixtureUtil.SkipTrigger = true;
|
//StaticParameter.EscapeVMCTrigger = true;
|
ConsumTestDataFactory factory = new ConsumTestDataFactory();
|
factory.setupTestData();
|
factory.selectDetails();
|
try {
|
factory.approve();
|
} catch (Exception e) {
|
|
}
|
|
factory.unAssign();
|
Consum_Apply_Equipment_Set_Detail__c caesd = [SELECT Id, RAESD_Status__c, Consum_Apply_Equipment_Set__c FROM Consum_Apply_Equipment_Set_Detail__c];
|
// System.assertEquals('待分配', caesd.RAESD_Status__c);
|
|
PageReference ref = new PageReference('/apex/ConsumSelect?recid=' + caesd.Consum_Apply_Equipment_Set__c);
|
Test.setCurrentPage(ref);
|
ConsumSelectController controller = new ConsumSelectController();
|
CreateRelationListPagingCmpCtrl cmp = new CreateRelationListPagingCmpCtrl();
|
cmp.pageController = controller;
|
controller.myComponentController.init();
|
controller.init();
|
|
controller.searchOpp();
|
//System.assertEquals(1, controller.viewList.size());
|
|
Test.startTest();
|
controller.tradeCheckTwo();
|
caesd.Fen_Pei_Shu_Liang_Jia__c = 1;
|
controller.save();
|
Test.stopTest();
|
|
caesd = [SELECT RAESD_Status__c FROM Consum_Apply_Equipment_Set_Detail__c];
|
// System.assertEquals('已分配',caesd.RAESD_Status__c);
|
}
|
|
static testMethod void testSave() {
|
Oly_TriggerHandler.bypass('ConsumApplyTriggerHandler');
|
FixtureUtil.SkipTrigger = true;
|
ConsumTestDataFactory factory = new ConsumTestDataFactory();
|
factory.setupTestData();
|
//factory.selectDetails();
|
// try {
|
// factory.approve();
|
// } catch (Exception e) {
|
|
// }
|
|
factory.defaultAssign();
|
Consum_Apply_Equipment_Set_Detail__c caesd = [SELECT Id, RAESD_Status__c, Consum_Apply_Equipment_Set__c FROM Consum_Apply_Equipment_Set_Detail__c];
|
// System.assertEquals('已分配', caesd.RAESD_Status__c);
|
|
PageReference ref = new PageReference('/apex/ConsumSelect?recid=' + caesd.Consum_Apply_Equipment_Set__c);
|
Test.setCurrentPage(ref);
|
ConsumSelectController controller = new ConsumSelectController();
|
CreateRelationListPagingCmpCtrl cmp = new CreateRelationListPagingCmpCtrl();
|
cmp.pageController = controller;
|
controller.myComponentController.init();
|
controller.init();
|
controller.searchOpp();
|
List<Consum_Apply_Equipment_Set_Detail__c> caesdList = [SELECT Id FROM Consum_Apply_Equipment_Set_Detail__c];
|
controller.setViewList(caesdList);
|
System.assertEquals(1, controller.viewList.size());
|
|
Test.startTest();
|
controller.viewList[0].check = true;
|
caesd = (Consum_Apply_Equipment_Set_Detail__c) controller.viewList[0].sobj;
|
caesd.Fen_Pei_Shu_Liang_Jia__c = 0;
|
controller.save();
|
Test.stopTest();
|
// 一览下全都已分配的话,就不能取消分配
|
// caesd = [SELECT RAESD_Status__c FROM Consum_Apply_Equipment_Set_Detail__c];
|
// System.assertEquals('已分配',caesd.RAESD_Status__c);
|
}
|
|
static testMethod void testCoverUp() {
|
ConsumSelectController.test();
|
}
|
}
|