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 Updates
APA

Posts on LINQ to Fail | Sciencx (2013-01-08T00:00:00+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 ,<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 ]. 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 . 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: ]
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/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.