Sorry for the weird caption. Here's what I'm going to do:
I'm in the client code, calling a method on the server. As a result, the server is going to send certain data to the client. I'd like to validate that these data have arrived within a second, which is necessarily the case unless something went seriously wrong. The code looks like this:
Channel.SendMeData (id);
new Thread (() => {
Thread.Sleep (1100);
Debug.Assert (ReceivedData[id] != null);
}) {
IsBackground = true
}.Start ();
As you can see, I'm creating a new thread solely for Debug.Assert
ing a condition that relies on successful network code. I can't help but think this is terribly wrong for multiple reasons, but I don't really see how this can be avoided. I did write unit tests, of course, but I like to have the assertion in the main code as well.