You need to sign in to do that
Don't have an account?

Test Class Mock User
Hi , Can we create a mock user for testclass along with the Role
For Eg: 'Custom Profile' with 'Manager Role'
I am able to retrive both Profile id and role id. of which assining it to the new users respective Field.
But i am unable to get the user Created as it Throws an MIXED_DML_OPERATION.
also tried with the workaround from Blogs to use @future annotation. by this it excecutes fine but dose not asign the role in the Context.
Please leme know if i am missing anything.
You can't specify a role...
http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_dml_non_mix_sobjects.htm
All Answers
Can you post the code, so that I/someone can see that and provide a solution?
Hi Imran Bhai,
Thanks for the reply,
below is the snippet.
Any clue...
You can't specify a role...
http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_dml_non_mix_sobjects.htm
Hi, @sfdcfox you saved me.
I got to know with link you shared that Mixed DML Operations can be performed with the System.RunAs();
Thats exactly what i was looking for.
Thanks.