You need to sign in to do that
Don't have an account?
deeksharth srivastava
how to write a test class for this
public with sharing class AddToCampaignController
{
public TTL_Residential__Property__c c{get;set;}
private set<string> ids = new set<string>();
public AddToCampaignController(ApexPages.StandardSetController standardController)
{
for(Sobject standcont:standardController.getSelected())
{
ids.add(standcont.id);
// this.standardController = standardController;
}
c = new TTL_Residential__Property__c();
}
public void UpdateRecord()
{
list<TTL_Residential__Property__c> updtlst= new list<TTL_Residential__Property__c>();
for(TTL_Residential__Property__c obj2 :[select Id , Name,Campaign_Lookup__c from TTL_Residential__Property__c where id in:ids])
{
if(obj2.Campaign_Lookup__c ==null)
{
obj2.Campaign_Lookup__c=c.Campaign_Lookup__c;
updtlst.add(obj2);
}
}
if(updtlst.size()>0)
update updtlst;
}
}
{
public TTL_Residential__Property__c c{get;set;}
private set<string> ids = new set<string>();
public AddToCampaignController(ApexPages.StandardSetController standardController)
{
for(Sobject standcont:standardController.getSelected())
{
ids.add(standcont.id);
// this.standardController = standardController;
}
c = new TTL_Residential__Property__c();
}
public void UpdateRecord()
{
list<TTL_Residential__Property__c> updtlst= new list<TTL_Residential__Property__c>();
for(TTL_Residential__Property__c obj2 :[select Id , Name,Campaign_Lookup__c from TTL_Residential__Property__c where id in:ids])
{
if(obj2.Campaign_Lookup__c ==null)
{
obj2.Campaign_Lookup__c=c.Campaign_Lookup__c;
updtlst.add(obj2);
}
}
if(updtlst.size()>0)
update updtlst;
}
}
https://developer.salesforce.com/page/An_Introduction_to_Apex_Code_Test_Methods