Advertisement
Guest User

Untitled

a guest
Feb 12th, 2016
48
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.57 KB | None | 0 0
  1. public class updatecon{
  2.  
  3. public id tobeEdited{get; set;}
  4. list<contact> lstcontact = [SELECT ID,name, Firstname,lastname,email,phone from contact];
  5.  
  6. public void saveRecord(){
  7. Contact tobeupdated;
  8. for(Contact temp : lstcontact){
  9. if(temp.id==tobeEdited){
  10. tobeupdated = temp;
  11. break;
  12. }
  13. }
  14. update tobeupdated;
  15. tobeEdited = null;
  16. }
  17. }
  18.  
  19. @istest
  20. public class testupdatecon{
  21. public static testMethod void testMyController(){
  22. updatecon update = new updatecon();
  23. update .saveRecord();
  24. }
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement