Thank you for sending the issue. I attached a test project that contains the following example of mocking SPSecurity.RunWithElevatedPrivileges
. I have used JustMock SP1 for the purpose.
.Arrange(() => SPSecurity.RunWithElevatedPrivileges(Arg.IsAny<SPSecurity.CodeToRunElevated>()))
.DoInstead(() => called =
Here the issue could be that the delegate that you are passing in Mock.Arrange does not match with the one that is passed during actual execution. The solution is either to use Arg.IsAny<> or assign the expected delegate in a variable and then pass it in both places.
Please take a look at the project and let us know if you are still having problem.
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking
system and vote to affect the priority of the items