How are people unit testing code that uses Linq to SQL

后端 未结 7 834
生来不讨喜
生来不讨喜 2021-01-30 06:24

How are people unit testing code that uses Linq to SQL?

7条回答
  •  梦谈多话
    2021-01-30 07:05

    Wrap the DataContext, then mock the wrapper. Its the fastest way to get it done, tho it requires coding for testing, which some people think smells. But sometimes, when you have dependencies that cannot be (easily) mocked, its the only way.

提交回复
热议问题