You need to sign in to do that
Don't have an account?
Sunil.Varma
Can anyone help me out by writing test class for this.Thankyou!!
Test class for my apex class
public pagereference payOrder(){ List<Cart__c> cartList = [Select Id, Name__c, Brands__c,Price__c,Model__c,Image__c from Cart__c]; List<Order__c> oList = New List<Order__c>(); for(Cart__c cartOrder : cartList){ Order__c oOrder = New Order__c(); oOrder.Name__c = cartOrder.Name__c; oOrder.Model__c = cartOrder.Model__c; oOrder.Brand__c = cartOrder.Brands__c; oOrder.Image__c = cartOrder.Image__c; oOrder.Price__c = cartOrder.Price__c; oList.add(oOrder); } Insert oList; delete cartList; pagereference redirect = new PageReference('/apex/Redirect'); return redirect; }
Can anyone help me out by writing test class for this.Thankyou!!
Greetings to you!
Please try the below code, I have tested in my org and it is working fine. Kindly modify the code as per your requirement.
I hope it helps you.
Kindly let me know if it helps you and close your query by marking it as solved so that it can help others in the future. It will help to keep this community clean.
Thanks and Regards,
Khan Anas
All Answers
Greetings to you!
Please try the below code, I have tested in my org and it is working fine. Kindly modify the code as per your requirement.
I hope it helps you.
Kindly let me know if it helps you and close your query by marking it as solved so that it can help others in the future. It will help to keep this community clean.
Thanks and Regards,
Khan Anas
You helped me and It worked. Thank you.
Could you please help me with this method also:
Apex Class:
Thanking You in anticiption!!!