how mstest section exam listens an eventuality carried another thread?
im minute exam expects accept an eventuality an vigilant calling. specifically, i am job out an vigilant connects an aix accessory around ssh (using open source granados project), following disconnecting, i wish certain i accept onconnectionclosed eventuality being carried during disconnect. sounds rudimentary enough, ive combined tests past, nonetheless uncanny function occurring i trust associated threading.
basically, vigilant i lifting onconnectionclosed eventuality opposite thread i from. im observant i run exam selecting debug test ui, passes, nonetheless i select run test, fails (even there breakpoints set during debug run). ive finished googling found seems infer default mstest horde runs unparalleled thread mode nonetheless config change run multi thread mode. sounded logically repair problem, nonetheless course, not.
some posts ive opposing also me cruise mstest simply monitoring credentials threads (so events carried being heard). also sense, given seems work debug mode, seems repair above should logically solve problem, following im confused since its working. illusory im simply justly traffic threads, nonetheless i design still problem debug mode case.
has anyone else attempted exam something identical way? so, confront identical problems? so, solve them?
ive pasted applicable section exam formula next (ive private tie info confidence reasons).
[testclass]
public category sshreadertests
{
private bool viewed = false;
private nominee bool simplefunc();
[testinitialize]
open vacant mytestinitialize()
{
viewed = false;
}
[testmethod]
open vacant should_raise_onreaderconnectionclosed_event_after_successful_connection_is_disconnected()
{
ireader reader = new sshreader();
reader.onreaderconnectionclosed += delegate
{
viewed = true;
};
reader.connect("*****", "*****", "*****");
//assert.istrue(reader.isconnected);
reader.disconnect();
//assert.isfalse(reader.isconnected);
assert.istrue(waituntiltrue(delegate {
relapse received; }, 30000, 1000));
}
private stationary bool waituntiltrue(simplefunc func, int timeoutinmillis, int timebetweenchecksinmillis)
{
stopwatch stopwatch = new stopwatch();
stopwatch.start();
while(stopwatch.elapsedmilliseconds < timeoutinmillis)
{
(func())
relapse true;
thread.sleep(timebetweenchecksinmillis);
}
relapse false;
}
}
Comments
Post a Comment