Faking Private Static Methods
To fake a private static method, pass the type and name of the method.
Syntax
C# Isolate.NonPublic.WhenCalled<type>("<methodname>").<behavior>
VB
Isolate.NonPublic.WhenCalled(of <type>)("<methodname>").<behavior>
Samples
C# // Use this line to set expectation on private static method Isolate.NonPublic.WhenCalled(typeof(Dependency), "PrivateStaticMethod").WillReturn(10); // Or you can use this line instead to set the same expectation Isolate.NonPublic.WhenCalled<Dependency>("PrivateStaticMethod").WillReturn(10);
VB
'Use this line to set expectation on private static method
Isolate.NonPublic.WhenCalled(GetType(Dependency), "PrivateStaticMethod").WillReturn(10)
'Or you can use this line instead to set the same expectation
Isolate.NonPublic.WhenCalled(Of Dependency)("PrivateStaticMethod").WillReturn(10)