I m using mock objects in the Nunit unit tests using C#. I am facing this problem
suppose I have a object ABC which I want to test. This object has Another object XYZ as its member variable. Something like this.
class ABC{ XYX p; (XYZ can be fetched using the get method and there is no set method) ......
}
I am creating mock object of the XYZ class. I can successfully creat the XYZ mock object. When I create an instance of ABC class, an instance of XYZ is being created which I intend to overwrite wid my mock object. The problem is that the XYZ class in the ABC class just provides the Get method to the Class ABC, so I cannot overwrite the instance of XYZ with my mock object of XYZ. Is ther a hack to overcome this problem.