2011年3月31日

为单元测试等非WebBase的项目伪造一个HttpContext , Session 和HttpHeader

摘要: 在做单元测试的时候HttpContext.Current是为null的而有些dll是和HttpContext绑定的(很大原因是...net大部分用于web项目)或者是试图在windows form 或者console中使用这些dll就挂了...当然HttpContext.Current是可以赋值的...那么最最简单的方法就是直接new一个HttpContext给它啦HttpRequest request = new HttpRequest("", "http://localhost", ""); HttpContext.Current 阅读全文

posted @ 2011-03-31 18:15 听说读写 阅读(1883) 评论(1) 推荐(0) 编辑

Common Log File System in windows 2008 性能测试

摘要: CLFS 是windows 服务器系统内置支持的日志系统可以直接使用System.IO.Logging 命名空间下面的相关类来操作写入速度测试环境:windows2008R2 sp1 (不要在xp上测试..这东西不支持的)没有raid8g 内存CPU: E5440写入1百万条日志每条512KB 预计日志大小至少512M最终耗时22秒...平均每秒4万多条测试代码很烂....如下所示string fullPath = @"c:\log\1.log"; int extentSize = 20 * 1024 * 1024; int logCount = 1 * 1000 * 10 阅读全文

posted @ 2011-03-31 17:48 听说读写 阅读(842) 评论(0) 推荐(0) 编辑

导航