c# - xUnit Async Test in Callback -


this current test. succeeds, should obvious not do. how make test fail?

[fact] public async task executecallback() {     timer timer = new timer();     timer.elapsed += (sender, e) =>     {         new myclassundertest((param) =>         {             assert.null(param);             assert.notnull(param);             timer.stop();         });     };     timer.interval = 500;     timer.start();     system.threading.thread.sleep(1000); } 

i want test inner logic of class (how executes provided action , parameters), , it's behavior when runs in eventhandler since tricky things threads.

as mentioned timer event handler runs on different thread nunit test. thrown exception not caught nunit, test succeeds.


Comments

Popular posts from this blog

java - UnknownEntityTypeException: Unable to locate persister (Hibernate 5.0) -

python - ValueError: empty vocabulary; perhaps the documents only contain stop words -

ubuntu - collect2: fatal error: ld terminated with signal 9 [Killed] -