@isTest
|
private class ConsumTrialConfirmControllerTest {
|
// 造出已收货
|
/*@testSetup static void setupTestData() {
|
ConsumTestDataFactory factory = new ConsumTestDataFactory();
|
factory.setupTestData();
|
factory.selectDetails();
|
factory.approve();
|
factory.defaultAssign();
|
factory.shippmentRequest();
|
factory.shipment();
|
factory.receive();
|
}
|
|
// 全部消耗
|
static testMethod void testAllConsumed() {
|
Consum_Apply__c ca = null ;
|
List<Consum_Apply_Equipment_Set_Detail__c> caesdList = null;
|
ca = [SELECT Id, HP_received_sign_rich__c FROM Consum_Apply__c LIMIT 1];
|
caesdList = [SELECT Check_lost_Item__c FROM Consum_Apply_Equipment_Set_Detail__c];
|
System.assertEquals(null, ca.HP_received_sign_rich__c);
|
System.assertEquals(null, caesdList[0].Check_lost_Item__c);
|
|
PageReference ref = new PageReference('/apex/ConsumTrialConfirm?id=' + ca.Id);
|
Test.setCurrentPage(ref);
|
ConsumTrialConfirmController controller = new ConsumTrialConfirmController();
|
// controller.init();
|
// Test.startTest();
|
// controller.ca.HP_received_sign_rich__c = '试用表';
|
// controller.allConsumed();
|
// Test.stopTest();
|
|
// ca = [SELECT Id, HP_received_sign_rich__c FROM Consum_Apply__c LIMIT 1];
|
// caesdList = [SELECT Check_lost_Item__c FROM Consum_Apply_Equipment_Set_Detail__c];
|
// System.assertEquals('试用表', ca.HP_received_sign_rich__c);
|
// System.assertEquals('消耗', caesdList[0].Check_lost_Item__c);
|
}
|
|
// 部分寄回
|
static testMethod void testPartSendback() {
|
Consum_Apply__c ca = null ;
|
List<Consum_Apply_Equipment_Set_Detail__c> caesdList = null;
|
ca = [SELECT Id, HP_received_sign_rich__c FROM Consum_Apply__c LIMIT 1];
|
caesdList = [SELECT Check_lost_Item__c FROM Consum_Apply_Equipment_Set_Detail__c];
|
System.assertEquals(null, ca.HP_received_sign_rich__c);
|
System.assertEquals(null, caesdList[0].Check_lost_Item__c);
|
|
PageReference ref = new PageReference('/apex/ConsumTrialConfirm?id=' + ca.Id);
|
Test.setCurrentPage(ref);
|
ConsumTrialConfirmController controller = new ConsumTrialConfirmController();
|
// controller.init();
|
// Test.startTest();
|
// controller.ca.HP_received_sign_rich__c = '试用表';
|
// controller.partSendback();
|
// Test.stopTest();
|
|
// ca = [SELECT Id, HP_received_sign_rich__c FROM Consum_Apply__c LIMIT 1];
|
// caesdList = [SELECT Check_lost_Item__c FROM Consum_Apply_Equipment_Set_Detail__c];
|
// System.assertEquals('试用表', ca.HP_received_sign_rich__c);
|
// System.assertEquals(null, caesdList[0].Check_lost_Item__c);
|
}
|
// 备品中心驳回
|
static testMethod void testReject() {
|
Consum_Apply__c ca = null ;
|
List<Consum_Apply_Equipment_Set_Detail__c> caesdList = null;
|
ca = [SELECT Id, HP_received_sign_rich__c FROM Consum_Apply__c LIMIT 1];
|
//caesdList = [SELECT Check_lost_Item__c FROM Consum_Apply_Equipment_Set_Detail__c];
|
//ca.HP_received_sign_rich__c = '试用表';
|
//update ca;
|
//caesdList[0].Check_lost_Item__c = '消耗';
|
//update caesdList;
|
|
PageReference ref = new PageReference('/apex/ConsumTrialConfirm?id=' + ca.Id);
|
Test.setCurrentPage(ref);
|
ConsumTrialConfirmController controller = new ConsumTrialConfirmController();
|
controller.init();
|
Test.startTest();
|
controller.ca.HP_received_sign_NG__c = true;
|
controller.save();
|
controller.ca.HP_received_sign_NG__c = true;
|
controller.ca.HP_received_sign_NG_Reason__c = '理由';
|
controller.save();
|
Test.stopTest();
|
|
// caesdList = [SELECT Check_lost_Item__c FROM Consum_Apply_Equipment_Set_Detail__c];
|
// System.assertEquals(null, caesdList[0].Check_lost_Item__c);
|
|
}
|
// 备品中心确认
|
static testMethod void testConfirm() {
|
Consum_Apply__c ca = null ;
|
List<Consum_Apply_Equipment_Set_Detail__c> caesdList = null;
|
ca = [SELECT Id, HP_received_sign_rich__c FROM Consum_Apply__c LIMIT 1];
|
//caesdList = [SELECT Check_lost_Item__c FROM Consum_Apply_Equipment_Set_Detail__c];
|
//ca.HP_received_sign_rich__c = '试用表';
|
//update ca;
|
//caesdList[0].Check_lost_Item__c = '消耗';
|
//update caesdList;
|
|
PageReference ref = new PageReference('/apex/ConsumTrialConfirm?id=' + ca.Id);
|
Test.setCurrentPage(ref);
|
ConsumTrialConfirmController controller = new ConsumTrialConfirmController();
|
controller.init();
|
Test.startTest();
|
controller.ca.AssetManageConfirm__c = true;
|
controller.save();
|
controller.ca.HP_received_sign_rich__c = '试用表';
|
controller.ca.AssetManageConfirm__c = true;
|
controller.save();
|
Test.stopTest();
|
|
// ca = [SELECT Id, HP_received_sign_rich__c FROM Consum_Apply__c LIMIT 1];
|
// caesdList = [SELECT Check_lost_Item_Final__c FROM Consum_Apply_Equipment_Set_Detail__c];
|
// System.assertEquals('消耗', caesdList[0].Check_lost_Item_Final__c);
|
}*/
|
|
static testMethod void testCoverUp() {
|
ConsumTrialConfirmController.test();
|
}
|
}
|