c# - Is anyone having trouble Ctrl-R, T running a specific locally highlighted test when it is set to async? -


i noticed today ctrl-r, ctrl-t on highlighted test method in gui not debug test wrote when looks like:

 [testmethod]  public async void test()     {           await asyncmethod();     } 

the project builds, test doesn't run. there no fail message or error message found anyplace.

if remove async keyword, works fine. what's this?

in code, i'm awaiting asynchronous call. don't see why test runner couldn't deal it.

edit:

after looking @ tests output, message this:

uta007: method blah defined in class blah not have correct signature. test method marked [testmethod] attribute must non-static, public, return-type void , should not take parameter. example: public void test.class1.test(). additionally, return-type must task if running async unit tests. example: public async task test.class1.test2() ========== discover test finished: 3 found (0:00:00.1367583) ==========

i don't @ it, visual studio wants show me build output , errors more often.

the test discovery process not permit async void unit tests; believe place warning in output window. since async void method skipped on test discovery, won't run.

for asynchronous unit tests, use async task instead of async void. have more details in my recent msdn article on subject.


Comments

Popular posts from this blog

python - mat is not a numerical tuple : openCV error -

c# - MSAA finds controls UI Automation doesn't -

wordpress - .htaccess: RewriteRule: bad flag delimiters -