关于:Microsoft Pex和Moles v.s Commerce Server 2009 [英] About: Microsoft Pex and Moles v.s Commerce Server 2009

查看:67
本文介绍了关于:Microsoft Pex和Moles v.s Commerce Server 2009的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

亲爱的,

我正在开发一个使用Microsoft Commerce Server 2009的项目,并发现我们无法进行单元测试,因为商业环境始终会返回空值。我想知道Pex& Moles女士是否可以帮助我们做到这一点?是否可以像使用带有Sharepoint的P& M一样以
的方式完成?

I'm working on a project which using Microsoft Commerce Server 2009 and find out that we can not do the unit-test because the commerce context always return null. I wonder if Ms Pex&Moles could help us to do that? Could it be done in the same way as using P&M with Sharepoint?

谢谢。

推荐答案

Moles允许您模拟静态方法和属性,这在SharePoint或Commerce开发中非常常见。例如HttpContent.Current,SPContext.Current。要进行正确的单元测试,你必须将你的类与所有依赖项隔离开来,我不能真正看到你如何使用其他模拟框架来完成它,比如RhinoMocks。

Moles will allow you to mock static methods and properties, which are quite common in SharePoint or Commerce development. For example HttpContent.Current, SPContext.Current. To do proper unit testing you have to isolate your class from all the dependencies and I can’t really see how you can do it with other mock frameworks like RhinoMocks.

我发现Pex非常独特且非常有用。它分析代码,所有条件和值检查,并通过不同的方法参数生成具有高代码覆盖率的测试。手动操作非常困难和耗时。

I find Pex quite unique and very useful. It analyzes the code, all the conditions and value checks and generates tests with high code coverage by varying method arguments. Something that is quite hard and time consuming to do manually.

目前我已经在CS项目中实施了一个项目。它工作正常。

Currently I have implemented in one of the CS project & it worked fine.


这篇关于关于:Microsoft Pex和Moles v.s Commerce Server 2009的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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