BizMockReceiver hangs on Init()

Jan 30, 2012 at 8:39 AM


I've wrote a test unit using the BizMock framework. While trying to get it to work I ran into some troubles, some of them I overcame;

1. Why do you call Term() in BizMockReceiver.GetResponse() finally block? When I have more than one Expect.One.Response for the same port, it throws an exception "Adapter is already initialized";

2. If I run my test 4 times, it works as following: run #1 - success, run #2 - hang, run #3 - success, run #4 - hang. etc. As I debugged the code, I found out that the code hangs in BizMockReceiver.Init() on 'transportProxy.RegisterIsolatedReceiver(url, this);' line. In a MSDN article it is said that if one called RegisterIsolatedReceiver, then TerminateIsolatedReceiver should be called, otherwise RegisterIsolatedReceiver will hang. I assured that TerminateIsolatedReceiver  is being called, but still I need either to stop my application via BTS Administration Console or to run the test again. Why does this happen?