+ Start a Discussion
mahemahe 

Test case

Hi

 

Can you please help me to write teset case for below class. Thanks

 

public

withsharingclassListOf_Deliverables {

 

public string oppId='';

 

publicListOf_Deliverables(ApexPages.StandardSetController controller) {

oppId= ApexPages.currentPage().getParameters().

get('id');

 

//getDels();

 

}

publicListOf_Deliverables() {

oppId= ApexPages.currentPage().getParameters().

get('id');

getDels();

 

}

publicvoidsetOppId(string DSId){

oppId = DSId;

}

string UrltoOpen {

get;set;}

List<

Deliverable__c> dels{get; set;}

List<

Deliverable__c> unReceiveDels{get; set;}

 

publicstring getUrltoOpen(){

 

if(UrltoOpen == null || UrltoOpen == ''){

UrltoOpen =

'httpss://cs13.salesforce.com/apex/Receive_Deliverables?scontrolCaching=1&id=' + ApexPages.currentPage().getParameters().get('id') + '&DeliverablesIds=';

}

returnUrltoOpen;

}

public List<Deliverable__c> getDels() {

 

if(dels == null) dels = [select id,Name,Amount_Paid__c,Balance__c,Deliverable_Number__c,Partial_Amount__c,Make_Partial_Payment__c,Notify_DS_Owner_for_PO_TroubleShoot_Del__c,Work_Approved_By__c,Approved_By_Date__c,Contractor_Invoice__c, Deliverable_Amount__c,due_date__c,Approval_Status__c,Deliverable_Description__c,Opportunity__c fromDeliverable__cwhere ((Approval_Status__c =: 'Not Completed') and Extracted__c =: true) and Update__c =: 'U'and PO_Number__c <> nulland Opportunity__c =:oppId ];//OR (Approval_Status__c =: 'Deliverable Approved for Payment')returndels ;

}

public List<Deliverable__c> getUnReceiveDels() {

 

if(unReceiveDels == null) unReceiveDels = [select id,Name,Amount_Paid__c,Balance__c,Deliverable_Number__c,Partial_Amount__c,Make_Partial_Payment__c,Notify_DS_Owner_for_PO_TroubleShoot_Del__c,Work_Approved_By__c,Approved_By_Date__c,Contractor_Invoice__c, Deliverable_Amount__c,due_date__c,Approval_Status__c,Deliverable_Description__c,Opportunity__c fromDeliverable__cwhere (Approval_Status__c =: 'Deliverable Approved for Payment'and (Extracted__c =: trueOR Make_Partial_Payment__c =: true )) and Update__c =: 'U'and PO_Number__c <> nulland Opportunity__c =:oppId ];//OR (Approval_Status__c =: 'Deliverable Approved for Payment')returnunReceiveDels ;

}

publicPageReference ConfirmAction(){

 

string Del_Id=

null;

 

if(dels != null){

 

for(integer count=0; count< dels.size();count++)

{

if(dels[count].Notify_DS_Owner_for_PO_TroubleShoot_Del__c == true)

{

if(Del_Id != null){

Del_Id = Del_Id + dels[

count].Id +',';

}

else{

Del_Id = dels[

count].Id +',';

}

}

 

}

}

if(unReceiveDels != null){

 

for(integer count=0; count< unReceiveDels.size();count++)

{

if(unReceiveDels[count].Notify_DS_Owner_for_PO_TroubleShoot_Del__c == true)

{

if(Del_Id != null){

Del_Id = Del_Id + unReceiveDels[

count].Id +',';

}

else{

Del_Id = unReceiveDels[

count].Id +',';

}

}

 

}

}

string id = ApexPages.currentPage().getParameters().

get('id');

UrltoOpen = UrltoOpen+Del_Id;

PageReference OppPage =

new PageReference('/apex/Receive_Deliverables?scontrolCaching=1&id=' + id + '&DeliverablesIds='+Del_Id);

OppPage.setRedirect(

true);

 

returnOppPage;

}

publicPageReference CancelAction(){

string id = ApexPages.currentPage().getParameters().

get('id');

PageReference OppPage =

new PageReference('https://cs3.salesforce.com/'+ oppId);

OppPage.setRedirect(

true);

 

returnOppPage;

}

}