@isTest private class TrgOpportunityTest { @isTest static void test_method_one() { Account a = new Account(); a.Name = 'Wallyu'; insert a; Opportunity o = new Opportunity( Name = 'Merchandisebo', Autorenew__c = 'Yes', Account = a, StageName = 'Contract', CloseDate = DateTime.Now().Date(), Term_2_License_Start_Date__c = DateTime.Now().Date(), Term_2_License_End_Date__c = DateTime.Now().Date().addYears(1), HasBeenRenewed__c = false, Bill_When__c = 'In Arrears'); insert o; System.debug(LoggingLevel.WARN, '@@@TrgOpportunityTest.o : ' + o); Product2 p2 = new Product2(Name='Test Productrrrr',isActive=true); insert p2; Id pricebookId = Test.getStandardPricebookId(); PricebookEntry pbe = new PricebookEntry(Pricebook2Id=pricebookId, Product2Id=p2.Id, UnitPrice=99, isActive=true); insert pbe; OpportunityLineItem oli = new OpportunityLineItem(PriceBookEntryId=pbe.Id, OpportunityId=o.Id, Quantity=1, TotalPrice=99,Description='sdfsdfsdf'); List olilist=new List{oli}; insert (olilist); Test.startTest(); o.StageName = 'Purchased'; upsert o; System.debug(LoggingLevel.WARN, '@@@TrgOpportunityTest.o AFTER UPSERT : ' + o); Test.stopTest(); } }
Friday, May 22, 2015
Test for products without @isAllTestData
Labels:
test
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment