[TestMethod]
[HostType("ASP.NET")]
[UrlToTest("http://localhost:25153/qq/a.aspx")]
[AspNetDevelopmentServerHost(@"C:\Users\Public\Documents\ooooooo", "/")]
public void Test1()
{
var url = HttpContext.Current.Request.Url;
var root = HttpContext.Current.Server.MapPath("~/");
Assert.AreNotEqual(url, null);
}

Using above code, there is a probem that the unit test method can't be debug, the break point will never be hitted.

        [TestMethod]
[HostType("ASP.NET")]
[UrlToTest("http://localhost:25153/qq/a.aspx")]
[AspNetDevelopmentServerHost(@"C:\Users\Public\Documents\ooooooo", "/")]
public void Test1()
{ //System.Diagnostics.Debugger.Break();
System.Threading.Thread.Sleep( * );
//attach the web server process when it launched
var url = HttpContext.Current.Request.Url;
var root = HttpContext.Current.Server.MapPath("~/");
Assert.AreNotEqual(url, null);
}

reference:

http://msdn.microsoft.com/en-us/library/ms243172.aspx

http://www.asp.net/mvc/tutorials/older-versions/unit-testing/creating-unit-tests-for-asp-net-mvc-applications-cs

最新文章

  1. vijos1404 遭遇战
  2. 还是this的问题
  3. LinkedHahsMap和HashMap的比较
  4. Xamarin开发Android笔记:拍照或相册选取图片角度问题
  5. sql分页代码
  6. javascript实现数据结构与算法系列:栈 -- 顺序存储表示和链式表示及示例
  7. 开放封闭原则(OCP)
  8. Swift 实现图片转字符画的功能
  9. 深入了解一下PYTHON中关于SOCKETSERVER的模块-C
  10. vb combobox 用法问题总结
  11. stdarg.h头
  12. SQL-55 分页查询employees表,每5行一页,返回第2页的数据
  13. 今天在2cto网站看到一个有关try{}catch(){}finally{}语句中含有return的讲解,理解很透彻。
  14. mac date命令详解
  15. 初识Python-1
  16. B2B、B2C、C2C、O2O
  17. Linux基础知识之用户和用户组以及 Linux 权限管理
  18. Linux shell (6)
  19. 【Unity】6.7 向量和Vector3类
  20. Openstack入门篇(十二)之neutron服务(计算节点)的部署与测试

热门文章

  1. 动态修改 C 语言函数的实现
  2. 关于Eclispe插件开发起步(一)
  3. 使用jQuery获取Bootstrap Switch的值
  4. css关于宽度
  5. (原创)openvswitch实验连载1-fedora 17下安装openvswitch
  6. 关于async和await的一些误区实例详解
  7. 服务端缓存HttpRuntime.Cache的使用
  8. ASP.NET笔记之 ListView 与 DropDownList的使用(解决杨中科视频中的问题)
  9. VBA实现随意输入组合码,查询唯一标识码
  10. ubuntu下aircrack-ng的wifi破解