相关疑难解决方法(0)

使用NUnit Assert.Throws方法或ExpectedException属性?

我发现这些似乎是测试异常的两种主要方式:

Assert.Throws<Exception>(()=>MethodThatThrows());

[ExpectedException(typeof(Exception))]
Run Code Online (Sandbox Code Playgroud)

哪个最好?有人提供优势吗?或者仅仅是个人偏好的问题?

c# nunit unit-testing assert exception

144
推荐指数
4
解决办法
6万
查看次数

标签 统计

assert ×1

c# ×1

exception ×1

nunit ×1

unit-testing ×1