We're a place where coders share, stay up-to-date and grow their careers.
Unit Tests (100% or otherwise) are not an appropriate tool for assessing the design of your code.
Could be 100% Code Coverage, properly modularized & SOLID, and still have a blatant bug in it;
Here's some code:
public string foo(bool a, bool b) { string x = "Hello World"; if(a) x = null; if(b) x = x.ToUpper(); return x; }
and here are the tests for 100% code coverage:
Assert.AreSame("Hello World", target.foo(false, false)); Assert.AreSame(null, target.foo(true, false)); Assert.AreSame("HELLO WORLD", target.foo(true, true));
"Blatant bug" or intentionally sabotaged?
Unit Tests (100% or otherwise) are not an appropriate tool for assessing the design of your code.
Could be 100% Code Coverage, properly modularized & SOLID, and still have a blatant bug in it;
Here's some code:
and here are the tests for 100% code coverage:
"Blatant bug" or intentionally sabotaged?