liangx85

2012年5月30日

利用NUnit测试异常

摘要: 作为VS.net现在常用的单体测试工具NUnit也可以对程序设定的异常进行测试,以下是测试实例。 1.测试对象抛出一个系统异常。 public virtual void Sample() { throw new System.AggregateException(); } 2.测试程序 测试发生异常 [Test] public void TestDeleteFile() { System.AggregateException exception = null; try { DeleteFile(); } catch(System.AggregateException ex) { except. 阅读全文

posted @ 2012-05-30 15:25 liangx85 阅读(600) 评论(1) 推荐(0) 编辑

导航