chevron-thin-right chevron-thin-left brand cancel-circle search youtube-icon google-plus-icon linkedin-icon facebook-icon twitter-icon toolbox download check linkedin phone twitter-old google-plus facebook profile-male chat calendar profile-male
Welcome to Typemock Community! Here you can ask and receive answers from other community members. If you liked or disliked an answer or thread: react with an up- or downvote.
0 votes

To verify the number of times a friend parameter method is called I have used below code 

Isolate.NonPublic.WhenCalled(fakeDeposit, "ValidateISAContributionLimit").DoInstead(Function(c)
                                                                                                methodCallCount += 1
                                                                                            End Function)


But the above code is throwing below run time exception

*** WhenCalled() with a fake object can only be used on instance methods. To set behavior on static method WealthNET.Server.Deposit.ValidateISAContributionLimit use WhenCalled() with a type argument

Thanks in advance



asked by (6.1k points)

1 Answer

0 votes

Hi onkarw210,

Does the "ValidateISAContributionLimit" Method is a static method?

If its a static method, the WhenCalled method takes the dependency type as the first parameter,

for example: 

Isolate.NonPublic.WhenCalled(GetType(fakeDeposit), "ValidateISAContributionLimit").DoInstead(Function(c)
                                                                                        methodCallCount += 1
                                                                                    End Function)
Typemock Support. 
answered by (1.3k points)