Hi all,
How does TypeMock deal with casting?
For example:
My Code
...
myClass
{
private IToyota _myToyota;
...
IVehicle myVehicle;
myVehicle = _myToyota as IVehicle;
if(myVehicle != null)
myVehicle.ShutDownEngine();
...
}
Now here is the test code I would write:
MockObject mockToyota = MockManager.MockObject(typeof(IToyota));
myClassAccessor._myToyota = mockToyota.object as IToyota;
My questions are:
1) Whenever my code under test runs to the casting as IVehicle, myVehicle is null because the casting did not succeed, and I cannot check if ShutDownEngine() is called. How would I mock such a casting?
2) How would I expect a call to ShutDownEngine()?
Any suggestions would be greatly appreciated!
Thanks,
YFC