Easily replacing Assert.IsTrue statements

I blogged/ranted about Assert.IsTrue previously, well today I decided to work out a quick way to do bulk conversions of tests.
Well the easiest way to go about this is using a good old Regular Expression:
Assert\.IsTrue\((?<Actual>.*)\s*==\s*(?&l…

I blogged/ranted about Assert.IsTrue previously, well today I decided to work out a quick way to do bulk conversions of tests.
Well the easiest way to go about this is using a good old Regular Expression:
Assert\.IsTrue\((?<Actual>.*)\s*==\s*(?<Expected>.*)\) That’s a regex which is ideal for using from Visual Studio, or any other tool that supports named capture groups. If you don’t have something like that you can use numerical capture groups:


Print Share Comment Cite Upload Translate
APA
Posts on LINQ to Fail | Sciencx (2024-03-29T08:45:44+00:00) » Easily replacing Assert.IsTrue statements. Retrieved from https://www.scien.cx/2014/02/12/easily-replacing-assert-istrue-statements/.
MLA
" » Easily replacing Assert.IsTrue statements." Posts on LINQ to Fail | Sciencx - Wednesday February 12, 2014, https://www.scien.cx/2014/02/12/easily-replacing-assert-istrue-statements/
HARVARD
Posts on LINQ to Fail | Sciencx Wednesday February 12, 2014 » Easily replacing Assert.IsTrue statements., viewed 2024-03-29T08:45:44+00:00,<https://www.scien.cx/2014/02/12/easily-replacing-assert-istrue-statements/>
VANCOUVER
Posts on LINQ to Fail | Sciencx - » Easily replacing Assert.IsTrue statements. [Internet]. [Accessed 2024-03-29T08:45:44+00:00]. Available from: https://www.scien.cx/2014/02/12/easily-replacing-assert-istrue-statements/
CHICAGO
" » Easily replacing Assert.IsTrue statements." Posts on LINQ to Fail | Sciencx - Accessed 2024-03-29T08:45:44+00:00. https://www.scien.cx/2014/02/12/easily-replacing-assert-istrue-statements/
IEEE
" » Easily replacing Assert.IsTrue statements." Posts on LINQ to Fail | Sciencx [Online]. Available: https://www.scien.cx/2014/02/12/easily-replacing-assert-istrue-statements/. [Accessed: 2024-03-29T08:45:44+00:00]
rf:citation
» Easily replacing Assert.IsTrue statements | Posts on LINQ to Fail | Sciencx | https://www.scien.cx/2014/02/12/easily-replacing-assert-istrue-statements/ | 2024-03-29T08:45:44+00:00
https://github.com/addpipe/simple-recorderjs-demo