You need to sign in to do that
Don't have an account?

Please help me test class for below controller
public class AddPersonCtrl { public Opportunity Opps; public Outside_People_Roles__c del; public Boolean refreshPage { get; set; } public List<Outside_People_Roles__c> addattendeeList {get;set;} public List<Outside_People_Roles__c> delattendeeList {get;set;} public List<Outside_People_Roles__c> attendeeList {get;set;} public Integer rowIndex {get;set;} public String currentRecordId; //public Boolean shouldRedirect {get;set;} public List<Outside_People_Roles__c> delAttendees {get; set;} public AddPersonCtrl(ApexPages.StandardSetController controller) { currentRecordId = ApexPages.CurrentPage().getparameters().get('id'); System.debug('currentRecordId'+currentRecordId); attendeelist=New List<Outside_People_Roles__c>(); attendeeList.add(new Outside_People_Roles__c(Opportunity__c = currentRecordId)); refreshPage = false; delattendeeList = new List<Outside_People_Roles__c>(); delattendees = new List<Outside_People_Roles__c>(); } public void addRow(){ attendeeList.add(new Outside_People_Roles__c(Opportunity__c = currentRecordId)); } public PageReference save(){ upsert attendeeList; PageReference pr = new PageReference('/' +currentRecordId); refreshPage = true; return pr; } public void deleteRow(){ rowIndex = Integer.valueOf(ApexPages.currentPage().getParameters().get('rowIndex')); System.debug('row be deleted ' + rowIndex ); attendeeList.remove(rowIndex); } }
Thankyou Advance.
Please see the sample code below
NOTE: The code provided is an example. Request you to please review and make modifications for your organization.
Let me know if this helps, if it does, please mark this answer as best so that others facing the same issue will find this information useful. Thank you