人们如何使用Linq to SQL进行单元测试代码 [英] How are people unit testing code that uses Linq to SQL

查看:60
本文介绍了人们如何使用Linq to SQL进行单元测试代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用Linq到SQL的人员单元测试代码如何?

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

推荐答案

更新:

Fredrik在他的博客上提供了有关如何对linq2sql应用程序进行单元测试的示例解决方案.您可以从以下位置下载它:

Fredrik has put an example solution on how to do unit test linq2sql applications over at his blog. You can download it at:

http://web.archive.org/web/20120415022448/http://iridescence.no/post/DataContext-Repository-Pattern-Example-Code.aspx

他认为发布示例解决方案不仅很棒,而且还设法提取了所有类的接口,这使设计更加分离.

Not only do I think its great that he posted an example solution, he also managed to extract interfaces for all classes, which makes the design more decoupled.

我的旧帖子:

**我发现这些博客是制作DataContext包装器的一个很好的开始: 链接2

*I found these blogs that I think are a good start for making the DataContext wrapper: Link1 Link2

它们几乎涵盖了相同的主题,只是第一个实现了为表提取接口的方法.第二个内容更广泛,因此我也将其包括在内.*

They cover almost the same topic except that the first one implements means for extracting interfaces for the tables as well. The second one is more extensive though, so I included it as well.*

这篇关于人们如何使用Linq to SQL进行单元测试代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆