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

test class
Hi,
Please help me with the test 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;