如何单元测试的HtmlHelper与起订量? [英] How to Unit Test HtmlHelper with Moq?

查看:175
本文介绍了如何单元测试的HtmlHelper与起订量?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人能告诉我,你将如何去带起订量创造一个模拟的HTML帮助?

Could somebody show me how you would go about creating a mock HTML Helper with Moq?

文章,有一个链接到一篇文章,声称来形容这一点,但仅之后返回ASP.NET运行时错误的链接

This article has a link to an article claiming to describe this, but following the link only returns an ASP.NET Runtime Error


我问有关同一主题<一个更具体的问题href=\"http://stackoverflow.com/questions/2485341/how-to-unit-test-htmlhelper-similar-to-usinghtml-beginform\">here,但目前还没有得到任何回应。我想这是太具体,所以我想我能得到一个更普遍的回答一个更普遍的问题,并对其进行修改以满足我的要求。

[edit] I asked a more specific question related to the same subject here, but it hasn't gotten any responses. I figured it was too specific, so I thought I could get a more general answer to a more general question and modify it to meet my requirements.

感谢

推荐答案

你可以做的是这样的:

HtmlHelper helper = null;
helper.YourHelperMethod();

没有必要嘲笑什么。辉煌的作品对我来说。

No need to mock anything. Works brilliant for me.

这篇关于如何单元测试的HtmlHelper与起订量?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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