c# - Should one use Assert in a method without TestMethod attribute? -


i taking on legacy code in c# , unit testing of code doesn't work.

let me explain following code.

[testmethod] public void sampletest() {     ...     // parallel call of method via threading     testutil(args);     ... }  private void testutil(...) {     ...     assert.istrue(condition1);     assert.istrue(condition2); } 

when run sampletest in visual studio, instead of marking test failed (because condition fails), vs throws exception in qtagent.exe.

do know why qtagent.exe crashes in case instead of failing test?

i it's totally fine put asserts private methods in test class. private methods can viewed code logically belongs in main method, has been broken out readability or code reuse. commonly put asserts private methods if asserts identical between multiple tests


Comments

Popular posts from this blog

javascript - Hide toolbar of pdf file opened inside iframe using firefox -

Copy range with conditional formatting -

Ansible - ERROR! the field 'hosts' is required but was not set -