How do I unit test persistence?

后端 未结 10 1309
长发绾君心
长发绾君心 2020-12-23 16:29

As a novice in practicing test-driven development, I often end up in a quandary as to how to unit test persistence to a database.

I know that technically this would

10条回答
  •  半阙折子戏
    2020-12-23 16:49

    For NHibernate, I'd definitely advocate just mocking out the NHibernate API for unit tests -- trust the library to do the right thing. If you want to ensure that the data actually goes to the DB, do an integration test.

提交回复
热议问题