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
Hello,

I want to mock a custom class, but only "normal" constructors. For doing so I use Reflective Mocks, as the class does not have any public constructors:

Mock SystemImageListMock = MockManager.Mock(typeof(SystemImageList), Constructor.StaticNotMocked);


However the static constructor is not called! This only happens when using

Mock SystemImageListMock = MockManager.Mock(typeof(SystemImageList), Constructor.NotMocked);


... but using this snippet, also the "normal" constructor is not mocked!

What is my mistake? What am I doing wrong?

Thanks for your help

Philipp
asked by philipp (2.9k points)

2 Answers

0 votes
Hi Philip

We tested this scenario and it works fine in our code.
Can you please post the code for SystemImageList constractors
with your test code?
How do you use the this class in the test?
answered by ohad (35.4k points)
0 votes
Yepp, you're right. It has been my mistake...
answered by philipp (2.9k points)
...