Say, for example, I have a method that checks for valid UK postcodes. I have written a unit test for that method that tests when a correct UK postcode is passed in, the method returns true.
Should I create a separate unit test to test for an incorrect UK postcode, or do it in the same unit test?
Thanks
You should create seperate test cases for each case. This will give you confidence that any future code that calls this method will work, also if you refactor you can see exactly which test fails, instead of just seeing 1test fail and have no idea why.