When writing unit tests, it is normally advisable to test the edge cases.
However, are these the right sort of things?
- Test the connection to the db is not open (assert an exception is thrown)
- Assert that a table, which must always have >1 row, does so
- Assert that a field which is required, is != null.
- Assert that an ip has been set in the right format (I can parse the string to IP).
Thanks
Your tests seem OK, but the phrase “edge case” normally refers to the tests and checks you need to do around the limits of the input.
Say you have a column in your database that can accept 50 characters. Your edge case tests are:
You can see that you are testing around and at the edges of your application where there are most likely to be errors. In this case there could be some confusion of the number of usable characters you can store which could cause errors in applications writing to your database.
Other tests where you would test saving a string of 20 characters and saving a string of 100 characters (say) should be done but these are going to be more stable.