Let say I have a class called CIRCLE, and another called SQUARE. In each of those class, I have a public function called area. (to calculate the area of the circle, and the area of the square respectively.)
I have also a class iMath. and in this class, I have a function ADD
Public Function ADD(byval c as CIRCLE, byval s as SQUARE)
Return c.area() + s.area()
End Function
Now I want to Unit test the ADD function. Obviously, for this very easy problem, I can easily create a circle object and a square object to Unit test my ADD function. However, let assume that my Circle object and Square object are very complicated objects, very hard to create a object, because they inherit and contains many other dependencies. In such case,
How can I fake the CIRCLE and SQUARE objects ? (note: the CIRCLE and SQUARE classes don't have Public Sub New without any parameter in it)
How can I fake the results of the area functions the CIRCLE and SQUARE objects (I just need a number to test my ADD function, and I don't care how the areas are calculated)