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
when working with legacy code, it's usually hard to "retrofit" unit testing. One of the reason is the setup code and interdependency.

One thing that would alleviate this task would be the ability to "extract" from the logger the actuall calls to an object and "copy/paste" these calls into the "expectation setup" of your unit test. either throught "reflective" or Natural Mock technique.

asked by bobbyangers (2.1k points)

1 Answer

0 votes

Yes we have contemplated a lot on doing something very much in the spirit of what you need.
Actually I don't know if you have seen the early posts about the new API but we have invested a lot of thought on coming up with ideas on how to help in these exact situations.

For example, one of the possibilities that will be available under the new API is to construct a fake that will always return a default value. This will allow you to define an instance (that you don't really care how it used or what it returns) be fully operational in a single line.

:idea: Try looking at the Isolator Custom Decorator, if you have some time and feel up to it, you can use those to extend the isolator framework to do exactly what you need.
answered by lior (13.2k points)