Hi,
I have been trying to create some unit tests for the following code:
void SecurityInitialized(PassedObject pObj) {
_dispatcher.BeginInvoke((CrossAppDomainDelegate) delegate() {
try {
pObj.DoSomething();
}
catch (Exception exception) {
}
});
}
_dispatcher is an object of System.Windows.Forms.Form class. Is there a way to mock the pObj object from the inside of the BeginInvoke?
I have tried:
Mock pObjMock = MockManager.MockObject(typeof(PassedObject));
pObjMock.ExpectCall("DoSomething");
and calling the SecurityInitlialized method
but it does not work. Typemock says that:
Not all expectations where called:
Method PassedObject.DoSomething has 1 more expected calls.