Wednesday 15 February 2012

c# - Test whether calling a function locks current thread -


I am writing an application that sends some commands to the serial port and gives some answers. At some point when some order port calling thread is sent, it will be locked until some answer is received. So I tried to write a failed test for this.

The problem is that it will not end at any time to pass the exam !!!!!

So what is the solution:

Edit: I can make another thread in my test and for two seconds after waiting for the test, check that the thread is not finished It breaks the rules of simplicity and tests on time.

Try to get a lock for the period of time that you think its unfair, whose After you stop trying to get the lock and fail it?

Use something like

No comments:

Post a Comment