代码改变世界

随笔档案-2013年04月

[翻译]NUnit---String && Collection && File && Directory Assert (七)

2013-04-13 21:31 by Max蚊子, 801 阅读, 收藏,
摘要: StringAssert (NUnit 2.2.3)StringAssert类提供一系列检查字符串的方法。View Code StringAssert.Contains( string expected, string actual );StringAssert.Contains( string expected, string actual, string message );StringAssert.Contains( string expected, string actual, string message, params ... 阅读全文

[翻译]NUnit---Exception && Utility Methods (六)

2013-04-01 21:55 by Max蚊子, 1332 阅读, 收藏,
摘要: Exception Asserts (NUnit 2.5)Assert.Throws作用于类本身,而不是比较值,它调用代理来验证抛代码片段出一个特定异常。在一个类可中Assert成功时可以是返回一个Exception而不是void,下面的例子代表了几种使用方式。Assert.Throws可以使用约束参数或者是异常类型作为预期的抛出异常类型。类型格式可以是泛型或者一般类型。Assert.DoesNotThrow用于确认代理不会抛出异常。Assert.Catch与 Assert.Throws 相似,但是当一个异常派生意另一个异常是会通过。View Code Exception Assert.Thr 阅读全文
网站:feiger.cn         飞鸽博客,关注互联网、站长圈的程序员博客!