I have a strange problem. I have a unit test which gets stuck in the run mode. When I run the same exam debug, there is no breakpoint, every time the exam passes.
Actually, this is a socket connection test. I disconnected the socket in the first and tried to connect again, and I am trying to check if the query was performed successfully.
Somewhere in the connect code, I check that the socket exception was. When this happens, the user is presented with some options in a dialogue, while the connection code hangs through an autoresave event, waiting for a decision.
This is the autreset event that hangs the system, it should be provided by the code in the unit test. But my question is, how does this pass in debug mode? Is there something special about debug mode, in which the AutoRateAvent is automatically determined by Visual Studio?
Edit
It was actually a race condition I added delay in code after my disconnected code, and it works now but it Still kills me in strange form that the situation of a race is starting. Extend me by pasting some code.
This test code is:
MySystem.FindEquipment (New list & lt; string & gt; (1) {"192.1.143: 28000"}); MySystem.ConstructSystem (); MySystem.IsConstructedFlag.WaitOne (); Assurance First (1, MySystem.CommunicationController.HardwareIPList.Count); PFFrame frame1 = MySystem.Frames ["0.x.x"]; Assert.IsTrue (frame1.Disconnect ()); Thread.Sleep (100); Assert.IsTrue (frame1.Connect ()); It kills me, that is, I am waiting for the return on the dunkencode code before calling the connecting code. The last part of the disconnected code looks like this:
lclSocket.Shutdown (SocketShutdown.Both); LclSocket.Close (); Onsocket Disconnect (new PFSocketConnectionEventArgs (ipEp)); Back true; Is it possible because the socket? Shut down (), and / or socket. Close () Methods Do It Run Threads? Thus, even though I am refunding a value with my disconnected code, is actually a socket actually not disconnected?
It looks like a running condition; Debug code usually runs extra stuff under 'hood' , And the difference in time is probably stopping your test.
Without seeing the code, we can not really help you a lot.
Comments
Post a Comment