You need to sign in to do that
Don't have an account?
Can somebody help me in writing the test class for the code (SelectOption class)
Hi,
I am not sure how to test this code. I dont know how to use the SelectOption in the test class. Can somebody tell me how should i write it??
public with sharing class ctrl_MultiSelectPickList
{
public String Label{get; set;}
public List<String> selected{get; set;}
public List<String> deselected{get; set;}
public SelectOption Available { get; set; }
public SelectOption Chosen { get; set; }
public List<SelectOption> selectedOptions = null;
public List<SelectOption> AllOptions = null;
// A Reference list (all options)
List<Options> opt{get; set;}
public List<SelectOption> getselectedOptions()
{
return selectedOptions;
}
public void setselectedOptions(List<SelectOption> value)
{
selectedOptions = value;
}
public List<SelectOption> getAllOptions()
{
return AllOptions;
}
public void setAllOptions(List<SelectOption> value)
{
AllOptions = value;
}
public class Options
{
public Integer Index{get; set;}
public String Item{get; set;}
}
Create the instance of class "ctrl_MultiSelectPickList" and call out methods in that class.
Here is your test class 100% code coverage, I hope will solve your issue.
You can read these too know how to write a test class.
http://forceschool.blogspot.com/search/label/Test%20Apex
Let me know if any issues.
Thanks Shashikant !! this was really helpful :)
Your welcome Neha
Please mark it as accepted solution, so that it helps others also.