How do I unit test persistence?

后端 未结 10 1278
长发绾君心
长发绾君心 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:51

    I usually create a repository, use that to save my entity and retrieve a fresh one. Then I assert that the retrieved is equal to the saved.

提交回复
热议问题