NUnit的测试MVC网站 [英] Nunit Testing MVC Site

查看:149
本文介绍了NUnit的测试MVC网站的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我碰到一个有点问题想单元测试一个MVC网站,我有。我需要很多的ASP.NET环境来运行(代httpcontexts,会话,饼干,会员资格等)全面测试一切。

I've run into a bit of an issue trying to unit test an MVC site I have: I require a lot of the ASP.NET environment to be running (generation of httpcontexts, sessions, cookies, memberships, etc.) to fully test everything.

即便是为了测试一些不太前端的东西需要才能正常工作成员,并且它一直挑剔得到这个全部由手工欺骗。

Even to test some of the less front end stuff needs memberships in order to properly work, and it's been finicky to get this all spoofed by hand.

有没有办法运转起来的NUnit的测试中的应用程序池?这似乎是最简单的方法。

Is there a way to spin up an application pool inside of NUnit tests? That seems like the easiest way.

推荐答案

我不知道的方式做到这一点,因为你的code不是在这个过程中,需要一个主机,是不是在ASPNET无论是。 (我以前错了,虽然哈哈)

I'm not aware of a way to do that since your code isn't in that process and requires a host that isn't in aspnet either. (I've been wrong before though haha)

从的Theres菲尔哈克旧的HttpSimulator,你有没有一个给定的旋转?

Theres an older HttpSimulator from Phil Haack, have you given that a whirl?

<一个href=\"http://haacked.com/archive/2007/06/19/unit-tests-web-$c$c-without-a-web-server-using-httpsimulator.aspx\" rel=\"nofollow\">http://haacked.com/archive/2007/06/19/unit-tests-web-$c$c-without-a-web-server-using-httpsimulator.aspx

这篇关于NUnit的测试MVC网站的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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