You need to sign in to do that
Don't have an account?
How would I test this code....
How would I test this code:
public class StaffWithSchedule{
public Date StartDate {get;set;}
public Date EndDate {get;set;}
public Staff__c Staff {get;set;}
public Appointment__c helper{
get{
Appointment__c retAppt = new Appointment__c();
if(Staff != null)
retAppt.Sales_Rep_1__c = Staff.id;
return retAppt;
}
}
public List<Appointment__c> Appointments {get;set;}
public List<Event> Events {get;set;}
public List<Project_Activity__c> ProjectActivities{get;set;}
public StaffWithSchedule(Staff__c inStaff, List<Appointment__c> inAppointments, List<Event> inEvents, List<Project_Activity__c> inProjActs, Date inStartDate, Date inEndDate){
if(inAppointments == null)
inAppointments = new List<Appointment__c>();
if(inEvents == null)
inEvents = new List<Event>();
Staff = inStaff;
Appointments = inAppointments;
ProjectActivities = inProjActs;
Events = inEvents;
StartDate = inStartDate;
EndDate = inEndDate;
}
Thanks in advance
Write a test method in same class or create a new test class,
then create an instance of your class with required constructor parameters. Use that instance object to cover class properties and methods.
Refer this link, It will help you in understanding and getting started with writing test methods.
Hi
here is test class try it
@isTest
private class StaffWithSchedule_test {
private staic void testmethod StaffWithSchedule_test()
{
StaffWithSchedule sws = new StaffWithSchedule();
sws.Staff__c='test'; //if it's datatype is string
sws..........
sws..........
sws...........
//like this u can pass the variables though this object so that every variable to be covered
}}
try this
if any issue let me know
SRS