You need to sign in to do that
Don't have an account?
How to pass values to controller from test method
Hi All,
I defined a object <Account_Movement__c> which have two lookup to accounts.
I wrote a VF where first selection is a lookup which is one of the lookup field in the object <Account_Movement__c> and another lookup is another lookup field in the object <Account_Movement__c> .
These lookup selected values i am passing to controller based upon user selection.
Every thing is working fine.
Now i am struck up in writing test method.I want to know how to pass the two lookup values to controller from test method.
Below is the snippet of my code from controller.
//No Argument constructor of controller
public AccMvmtController()
{
fromLogo= new Account_Movement__c();
toLogo = new Account_Movement__c();
isnotblank=false;
}
public Account_Movement__c fromLogo {get;set;}
public Account_Movement__c toLogo {get;set;}
Below is the VF Snippet where i am populating the lookup value
<apex:inputField id="fromLogo" required="true" value="{!fromLogo.FromLogo__c}" >
AccMvmtController con = new AccMvmtController();
Then, access the variables directly:
con.fromLogo.Account__c = a.id; // Where "a" is an account.