DEV Community

Discussion on: From TDD to DDD: Building a .NET Core Web API - Part 7

 
hidegh profile image
balazs HIDEGHETY

to make it clear, have separate SUCCESS and FAIL test is a good thing, like:

  • expect that all users with names less than 20 chars to be accepted
  • expect all users with names more than 20 chars to be rejected (rejection is accepted so it's our GREEN indicator).

best to do one test per fact, e.g. test the 20 char limit, test if there's at least a special char in the password and have multiple values for that test that should pass.

same way give multiple values for the test where the failing condition is tested, e.g.:
fact_password_without_special_chars_should_be_rejected