Breaking NUnit

Last night i wrote a unit test that to verify that a server component i was writing could accept a remote connection.  This test seamed to infinitly block a thread inside NUnit which i think is the result of a Join call on a background thread, whatever the reason, the thread blocks, which is fine in itself, but if you try and stop the blocking test using the NUnit GUI, the UI dies.

This is probably a sign that I should be using mock objects for things like Socket, I haven’t yet properly investigated mocks but i think if I get into situations like this more often they will be valuable.

[UPDATE]

The test now passes, it was a threading issue, I went temporarily insane and forgot to use any kind of syncronisation when accessing resources.

Moral of this story:”Don’t write sockets code at 2 AM.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s