Notes

出自Notes

Ways to Unit Test Database Access Code

1. via Transaction rollback

2. via Mock Object

3. via IoC

4. Prepare two database. One is read-only database, store the init data, one is for testing.

You can do it like this: on the test's SetUp method, delete the table existed in testing-database. then copy the tables from read-only database.

src: [1]