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
0 votes
>Initialization method *********************************************
threw exception. TypeMock.TypeMockException: TypeMock.TypeMockException: 
*** No method calls found in recording block. Please check:
 * Are you trying to fake a field instead of a property? try to set field
 * Are you are trying to fake an unsupported mscorlib type? See supported types here:</Message>Isolate.WhenCalled(() => FileVersionInfo.GetVersionInfo("")).WillReturn(fakeFileVersionInfo);
the code is
var fakeFileVersionInfo = Isolate.Fake.Instance<FileVersionInfo>(); 
Isolate.WhenCalled(() => fakeFileVersionInfo.ProductName).WillReturn("2015.3.0"); 
Isolate.WhenCalled(() => FileVersionInfo.GetVersionInfo(Assembly.GetExecutingAssembly().Location)).WillReturn(fakeFileVersionInfo);

I used TMock from command line through mstest

If FileVersionInfo is not mockable, is there any workaround?

asked by daily2432121 (1.1k points)

Please log in or register to answer this question.