How do I unit test persistence?

后端 未结 10 1307
长发绾君心
长发绾君心 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 17:08

    I would also mock the database, and check that the queries are what you expected. There is the risk that the test checks the wrong sql, but this would be detected in the integration tests

提交回复
热议问题