@isTest
|
private class TransferApplyDetailControllerTest {
|
static TransferTestDataFactory Factory;
|
//查到备品明细 备品中心之间
|
static testMethod void testMethod1() {
|
Test.startTest();
|
Factory = new TransferTestDataFactory();
|
Factory.CreateTa('CenterToCenter');
|
TransferApply__c raObj1 = [SELECT Id,Name,OwnerId,Status__c,Status_Text__c,Request_time__c,Request_approval_time__c FROM TransferApply__c WHERE RecordType.DeveloperName = 'CenterToCenter' limit 1];
|
|
raObj1.Status__c = FixtureUtil.raStatusMap.get(FixtureUtil.RaStatus.Yi_Pi_Zhun.ordinal());
|
raObj1.Status_Text__c = FixtureUtil.raStatusMap.get(FixtureUtil.RaStatus.Yi_Pi_Zhun.ordinal());
|
raObj1.Request_time__c = System.now();
|
raObj1.Request_approval_time__c = System.now();
|
update raObj1;
|
|
List<Asset> AssetList = [SELECT Id FROM Asset];
|
TransferApplySummary__c raesObj = new TransferApplySummary__c();
|
TransferApplyDetail__c raesdObj2 = new TransferApplyDetail__c();
|
TransferApplyDetail__c raesdObj3 = new TransferApplyDetail__c();
|
raesObj.TransferApply__c = raObj1.Id;
|
//raesObj.Fixture_Set__c = fsObj1.Id;
|
raesObj.Cancel_Select__c = false;
|
raesObj.IndexFromUniqueKey__c = 1;
|
insert raesObj;
|
|
raesdObj2.TransferApply__c = raObj1.Id;
|
raesdObj2.Asset__c = AssetList[1].Id;
|
raesdObj2.TransferApplySummary__c = raesObj.Id;
|
raesdObj2.IndexFromUniqueKey__c = 1;
|
raesdObj2.ApplyPersonAppended__c = true;
|
raesdObj2.Create_State__c = 1;
|
raesdObj2.TransferCount__c = 1;
|
raesdObj2.FSD_SortInt__c = 01;
|
|
raesdObj3.TransferApply__c = raObj1.Id;
|
raesdObj3.Asset__c = AssetList[1].Id;
|
raesdObj3.TransferApplySummary__c = raesObj.Id;
|
raesdObj3.IndexFromUniqueKey__c = 1;
|
raesdObj3.ApplyPersonAppended__c = true;
|
raesdObj2.Create_State__c = 1;
|
raesdObj3.TransferCount__c = 1;
|
raesdObj3.FSD_SortInt__c = 02;
|
|
insert new TransferApplyDetail__c[] {raesdObj2,raesdObj3};
|
|
PageReference ref = new PageReference('/apex/TransferApplyDetailController?taId=' + raObj1.Id);
|
Test.setCurrentPage(ref);
|
TransferApplyDetailController controller1 = new TransferApplyDetailController();
|
controller1.taId = raObj1.Id;
|
controller1.gatherName = 'TransferEmail';
|
controller1.varType = 'add';
|
controller1.getinit();
|
|
raesdObj2.Cancel_Select__c = true;
|
raesdObj2.Cancel_Reason__c = 'test';
|
raesdObj2.Cancel_Time__c = System.now();
|
update raesdObj2;
|
|
controller1.varType = 'cancel';
|
controller1.getinit();
|
Test.stopTest();
|
}
|
}
|