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

Please help me out with the test class for the below class
Hi
Help me out with the testclass for the class
public class DonorProfileController
{
public String contactId {get;set;}
public Contact donorObj {get;set;}
public DonorProfileController() {
User oUser = [Select Id, ContactId From User Where Id=:UserInfo.getUserId()];
contactId = oUser.contactId;
donorObj = [Select FirstName,LastName,BirthDate,Description,Email,Phone,Mobilephone,Fax From Contact Where Id=:contactId];
}
public String firstname{ get; set; }
public String lastname{ get; set; }
public Date birthdate{ get; set; }
public String description { get; set; }
public String email { get; set; }
public String phone { get; set; }
public String homephone { get; set; }
public String fax { get; set; }
public String mobilephone { get; set; }
public PageReference saveAction()
{
System.debug('saveAction()');
// MyProfile__c profile=[Select Name,First_Name__c,BirthDate__c,Description__c,Fax__c,Email__c,Phone__c from MyProfile__c Where Id=:contactId ];
MyProfile__c profile=new MyProfile__c();
profile.Name = this.lastname;
profile.First_Name__c = this.firstname;
profile.BirthDate__c = this.birthdate;
profile.Description__c=this.description;
profile.Email__c=this.email;
profile.Phone__c=this.phone;
profile.Fax__c=this.fax;
profile.Mobile__c=this.mobilephone;
insert profile;
return null;
/* Contact donorObj = [Select FirstName,LastName,BirthDate,Description,Email,Phone,Mobilephone,Fax From Contact Where Id=:profile.Id];
donorObj.LastName = profile.Name;
donorObj.FirstName = profile.First_Name__c;
donorObj.BirthDate = profile.Birthdate__c;
donorObj.Description=profile.Description__c;
donorObj.Email=profile.Email__c;
donorObj.Phone=profile.Phone__c;
donorObj.Fax=profile.Fax__c;
donorObj.Mobilephone=profile.Mobile__C;
update donorObj;
*/
}