Just wondering if there is any way to mole other methods being used by the method under testing. For instance, in the following example, I am unit testing method1, which uses method2 in the same class. Can I mole method2?
Thanks a lot.
private void Method1 ()
val = Method2();
private int Method2()
}Saturday, December 18, 2010 3:35 PM
Try setting the InstanceBehavior of the moled instance to MoleBehaviors.FallThrough.
The FallThrough behavior is documented: Get a behavior that calls into the original implementation when no delegate is provided.
classAMole = new MClassA();
classAMole.InstanceBehavior = MoleBehaviors
classAMole.Method2 = () => 2;Tuesday, April 12, 2011 7:32 AM