@isTest
|
private class NotReceivingNoteListFirstControllerTest {
|
static testMethod void testMethod1() {
|
//创建收货清单
|
Date td = Date.today();
|
ReceivingNote__c rn = new ReceivingNote__c();
|
rn.Internal_asset_location__c = '上海 张江';
|
rn.Asset_loaner_category__c = '固定资产';
|
rn.Name = 'ZZ-153PA-0000813';
|
rn.Status__c = '待数据确认';
|
rn.DateOfDelivery__c = td+7;
|
rn.OrderCode__c = 'SHRC-SP-20044-02';
|
rn.Sales_order_number__c = '1000109900';
|
rn.ApprovalNumber__c = 'ME153P07-0301';
|
rn.ContactPerson__c = 'username';
|
insert rn;
|
//收货清单一览
|
ReceivingNoteSummary__c rns = new ReceivingNoteSummary__c();
|
rns.ReceivingNote__c = rn.Id;
|
insert rns;
|
|
// 收货一览明细
|
ReceivingNoteDetail__c rnd1 = new ReceivingNoteDetail__c();
|
rnd1.ReceivingNoteSummary__c = rns.Id;
|
rnd1.Is_Body__c = true;
|
rnd1.SerialNumber__c = '12';
|
|
insert new ReceivingNoteDetail__c[] {rnd1};
|
|
PageReference ref = new PageReference('/apex/NotReceivingNoteListFirst');
|
Test.setCurrentPage(ref);
|
|
List<RecordType> rectCo = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '販売店'];
|
if (rectCo.size() == 0) {
|
return;
|
}
|
|
Account myAccount1 = new Account(name='Testaccount001',Dealer_discount__c =30,RecordTypeId = rectCo[0].Id,AgentCode_Ext__c = '9999960');
|
insert myAccount1;
|
|
NotReceivingNoteListFirstController controller = new NotReceivingNoteListFirstController();
|
CreateRelationListPagingCmpCtrl cmp = new CreateRelationListPagingCmpCtrl();
|
cmp.pageController = controller;
|
controller.myComponentController.init();
|
|
controller.init();
|
controller.getAsset_loaner_categoryOps();
|
controller.getRNStatusOpss();
|
controller.beiPinCunfangDi = '上海';
|
controller.contactPerson = 'user';
|
// controller.dateOfDelivery = td.format();
|
controller.salesOrderNumber = '10001099';
|
controller.orderCode = 'SHRC';
|
controller.approvalNumber = 'ME153P07';
|
controller.searchOpp();
|
|
System.assertEquals(1, controller.viewList.size());
|
|
controller.viewList[0].check = true;
|
controller.save();
|
|
}
|
}
|