Guest User

Untitled

a guest
Jan 21st, 2019
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.40 KB | None | 0 0
  1. @isTest
  2. public class AssetTriggerTest2 {
  3.  
  4. @isTest static void test(){
  5.  
  6. Account acc = new Account();
  7. acc.Name = 'farah test';
  8. insert acc;
  9.  
  10. Opportunity opp = new Opportunity();
  11. opp.Name = 'tests';
  12. opp.CloseDate = Date.today();
  13. opp.StageName ='Demo';
  14. opp.AccountId = acc.Id;
  15. opp.Type='New';
  16. opp.Demo_Date__c = Date.today();
  17. opp.New_Vehicle_Feed_Provider__c ='AutoFunds';
  18. insert opp;
  19.  
  20. Product2 p1 = new Product2();
  21. p1.Family = '360 Suite';
  22. p1.IsActive = true;
  23. p1.Name ='360 Suite';
  24. insert p1;
  25.  
  26. Id pricebookId = Test.getStandardPricebookId();
  27. PricebookEntry pb1 = new PricebookEntry();
  28. pb1.Product2Id =p1.Id;
  29. pb1.Pricebook2Id = pricebookId;
  30. pb1.UnitPrice = 100.00;
  31. pb1.IsActive = true;
  32. insert pb1;
  33.  
  34.  
  35. OpportunityLineItem oli = new OpportunityLineItem(
  36. OpportunityId = opp.Id,
  37. Quantity = 5,
  38. PricebookEntryId = pb1.Id,
  39. TotalPrice = Quantity * pb1.UnitPrice
  40. );
  41. insert oli;
  42.  
  43.  
  44. opp.StageName = 'Closed Won';
  45. update opp;
  46.  
  47.  
  48.  
  49. }
  50.  
  51. }
Add Comment
Please, Sign In to add comment