Unit-Testing functions which have parameters of classes where source code is not accessible

Posted by McMannus on Programmers See other posts from Programmers or by McMannus
Published on 2013-06-18T10:16:43Z Indexed on 2013/06/25 10:28 UTC
Read the original article Hit count: 343

Filed under:
|
|

Relating to this question, I have another question regarding unit testing functions in the utility classes:

Assume you have function signatures like this:

public function void doSomething(InternalClass obj, InternalElement element)

where InternalClass and InternalElement are both Classes which source code are not available, because they are hidden in the API. Additionally, doSomething only operates on obj and element. I thought about mocking those classes away but this option is not possible due to the fact that they do not implement an interface at all which I could use for my Mocking classes.

However, I need to fill obj with defined data to test doSomething.

How can this problem be solved?

© Programmers or respective owner

Related posts about c#

Related posts about testing