Suspending a thread for outstanding events

  • Thread starter Thread starter foldface
  • Start date Start date
F

foldface

Hi
I'm trying to unit test a winforms application using
nunitforms. To do this I don't use


Application.Run,


instead I use form1.Show(). To process any events that may
have gathered I use

Thread.Sleep(5000);

is there something better where I can say to the current thread, stop
in the middle of the method and process any outstanding events rather
than making up an arbitary time?

Ta
F
 
I'm trying to unit test a winforms application using
nunitforms. To do this I don't use


Application.Run,


instead I use form1.Show(). To process any events that may
have gathered I use

Thread.Sleep(5000);

is there something better where I can say to the current thread, stop
in the middle of the method and process any outstanding events rather
than making up an arbitary time?

Application.DoEvents should do it, but it's pretty nasty. Why aren't
you using Application.Run and handling long-running work in a different
thread, which is the normal way of doing things?
 
seems what I was after was simply Thread.Sleep(0);.

Its because I'm using NUnitForms and I want to, from a test harness,
press buttons and wait for the
outcome. In this particular case a button was raising a dialog which is
handled differently.
I think that somewhere in the program being debugged it may be waiting
for some event, paint,
invalidate, other?
Vague answer I'm afraid but I'm just getting into this at the mo.

Thanks for the reply.
 
Back
Top