I am trying to develop a Delete command through BDD that will simply delete an user from the database, given user_id as a parameter. What can be some possible behavioral tests that will drive me to write a proper implementation for the command?
1
Here are some possible tests:
- (Delete works) When
user_id
is in the database, ifdelete(user_id)
is called,user_id
will no longer be in the database - (Delete affects only one record) When
user_id
is in the database, and there are other users as well, ifdelete(user_id)
is called, the other users will still be in the database - (Delete no-op) When
user_id
is not in the database, ifdelete(user_id)
is called,user_id
should still not be in the database (or maybe an exception gets thrown; depends on your spec)
2