The problem with Assert.IsTrue

Have you ever seen a unit test that looks like this:
1 2 3 4 5 6 7 8 public void SomeTest() { var foo = new Bar(); var result = foo.GetStuff(); Assert.IsTrue(result.Count() == 1); } Do you know what’s wrong with this test? I’ll give you a c…


This content originally appeared on Posts on LINQ to Fail and was authored by Posts on LINQ to Fail

Have you ever seen a unit test that looks like this: 1 2 3 4 5 6 7 8 public void SomeTest() { var foo = new Bar(); var result = foo.GetStuff(); Assert.IsTrue(result.Count() == 1); } Do you know what’s wrong with this test? I’ll give you a clue, the developer use Assert.IsTrue and by doing so they’ve made a bad test. I see a lot of tests which contain Assert.


This content originally appeared on Posts on LINQ to Fail and was authored by Posts on LINQ to Fail


Print Share Comment Cite Upload Translate
APA
Posts on LINQ to Fail | Sciencx (2022-12-06T17:18:04+00:00) » The problem with Assert.IsTrue. Retrieved from https://www.scien.cx/2013/01/08/the-problem-with-assert-istrue/.
MLA
" » The problem with Assert.IsTrue." Posts on LINQ to Fail | Sciencx - Tuesday January 8, 2013, https://www.scien.cx/2013/01/08/the-problem-with-assert-istrue/
HARVARD
Posts on LINQ to Fail | Sciencx Tuesday January 8, 2013 » The problem with Assert.IsTrue., viewed 2022-12-06T17:18:04+00:00,<https://www.scien.cx/2013/01/08/the-problem-with-assert-istrue/>
VANCOUVER
Posts on LINQ to Fail | Sciencx - » The problem with Assert.IsTrue. [Internet]. [Accessed 2022-12-06T17:18:04+00:00]. Available from: https://www.scien.cx/2013/01/08/the-problem-with-assert-istrue/
CHICAGO
" » The problem with Assert.IsTrue." Posts on LINQ to Fail | Sciencx - Accessed 2022-12-06T17:18:04+00:00. https://www.scien.cx/2013/01/08/the-problem-with-assert-istrue/
IEEE
" » The problem with Assert.IsTrue." Posts on LINQ to Fail | Sciencx [Online]. Available: https://www.scien.cx/2013/01/08/the-problem-with-assert-istrue/. [Accessed: 2022-12-06T17:18:04+00:00]
rf:citation
» The problem with Assert.IsTrue | Posts on LINQ to Fail | Sciencx | https://www.scien.cx/2013/01/08/the-problem-with-assert-istrue/ | 2022-12-06T17:18:04+00:00
https://github.com/addpipe/simple-recorderjs-demo