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
What is the correct VB Syntax for this?

Isolate.WhenCalled(() => LoggerFactory.Count).WillReturn(10);

Thanks in advance!
asked by Bond007 (600 points)

1 Answer

0 votes

Sorry for the late response.

Here's the syntax:
Isolate.Fake.StaticMethods(Of LoggerFactory)()
Isolate.WhenCalled(Function() LoggerFactory.Count).WillReturn(5)

:arrow: If you use WhenCalled like this, you don't need the Fake.StaticMethods call. Only if you use FakeStaticMethods with Recursive fakes or any other non-default argument you need it.

:arrow: Note that since VB does not support anonymous delegates, we don't have a way to do a WhenCalled on a void method. For now.
answered by gilz (14.5k points)