我发现这些似乎是测试异常的两种主要方式:
Assert.Throws<Exception>(()=>MethodThatThrows()); [ExpectedException(typeof(Exception))]
哪个最好?有人提供优势吗?或者仅仅是个人偏好的问题?
c# nunit unit-testing assert exception
assert ×1
c# ×1
exception ×1
nunit ×1
unit-testing ×1