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 Answers. Here you can ask and receive answers from other community members. And if you liked or disliked an answer or thread: react with an up- or downvote Enjoy!
0 votes
I just started to use TypeMock yesterday and I am having a little trouble.

I read in the forum that there is some "Reserved" system types that cannot be mocked. Can we have the list?

In my example, I was using these types:
    XmlSerializer
    FileStream
    XmlTextReader


Are they reserved?

In my test, I tried to mock the FileStream

Mock streamMock = MockManager.Mock(typeof(FileStream));


but the FileStream constructor(filename, FileMode) was still called?

Thank you for your help,

Benjamin
asked by (1.8k points)

10 Answers

0 votes
I read in the forum that there is some "Reserved" system types that cannot be mocked. Can we have the list?

Hi,
As you said there are some reserved types, these are from the System namespace. We are working on a version that will enable to mock these types too. In the meantime, I will try to make a list for you. This also depends on the Testing Framework that you are using, can you please tell me what famework you are using.
answered by (32k points)
0 votes
Thanks Scott,

I am using NUnit version 2.2 for my tests.
answered by (1.8k points)
0 votes
Hi Benjamin,

Currently TypeMock.NET cannot mock types from precompiled assemblies. :cry:
These assemblies will be supported in a future version :D

A precompiled assemby is actually native code. To precompile an assembly use the NGEN command.
Using precompiled assemblies will make the code run faster as there is no need to compile MSIL to native code.


Here is a list of microsofts precompiled assemblies. (found by running ngen /show)
:arrow: CustomMarshalers
:arrow: Microsoft.VisualStudio
:arrow: Microsoft.VSDesigner
:arrow: Microsoft.VSDesigner.Mobile
:arrow: mscorlib
:arrow: System
:arrow: System.Design
:arrow: System.Drawing
:arrow: System.Drawing.Design
:arrow: System.Windows.Forms
:arrow: System.Xml
:arrow: vjscor
:arrow: VJSharpCodeProvider
:arrow: vjslib
:arrow: vjslibcw
:arrow: VJSWfcBrowserStubLib
answered by (32k points)
0 votes
Hi Scott,

Thanks for the list.

These assemblies will be supported in a future version :D


Do you know when this release is scheduled?


Regards,


Benjamin
answered by (1.8k points)
0 votes
Hi,
I am not sure, our philosophy is to make small releases every 4-6 weeks, and this feature should be part of one of the coming releases.
answered by (32k points)
0 votes
Hi Scott,

I was just wondering if the new release in coming up this week?

If my math is good 4 to 6 weeks from feb 3rd is March 3rd to 17nd.

:D That would mean release time again!!!

Keep up the good work,

Benjamin
answered by (1.8k points)
0 votes
Hi Benjamin
TypeMock.NET 2.2 will be out any day now :D
answered by (32k points)
0 votes
Hi,
TypeMock.NET 2.2 is out. You can now Mock all librarbies except for types from mscorlib.dll
answered by (3.9k points)
0 votes
Can you put a sticky somewhere so this is more coherently documented? Just tried mocking an Exception but it failed (cause it's a System.Exception in mscorlib, I'm testing logging functionality for different types of exceptions). I have to create a custom Exception class now to mock instead.

Thanks,

Benjamin
answered by (140 points)
0 votes
Hi Benjamin,

Sticky put :). The next docs will include the full list of supported types. We've misplaced it before, and it will be fixed next.

Cheers,
Gil
answered by (14.5k points)
...