I was trying to mock this:
If (Not My.User.IsInRole(My.Settings.TrustedAccount)) Then
Throw New System.Security.SecurityException("Some message.")
End If
I tried things like:
Using TheseCalls.WillReturn(true)
My.User.IsInRole("")
End Using
And the test fails with messages simlar to this:
*** You are using TheseCalls.ReturnValue incorrectly - Method get_User in type AgFirst.APS.APSWebServiceTest.My.MyProject returns Microsoft.VisualBasic.ApplicationServices.User and not System.Boolean.
Please use TheseCalls.WillReturn(Microsoft.VisualBasic.ApplicationServices.User).
So I tried to create a test with the above suggestion and failed.
Do you have any suggestions or can you point me to any examples that might get me going in the right direction? I am fairly new to using TypeMock.
I am using TypeMock 8.0.5.2.
Thanks.