📜  测试如何catch异常c#代码示例

📅  最后修改于: 2022-03-11 14:48:58.945000             🧑  作者: Mango

代码示例1
[TestMethod]
[ExpectedException(typeof(ArgumentException),
    "A userId of null was inappropriately allowed.")]
public void NullUserIdInConstructor()
{
   LogonInfo logonInfo = new LogonInfo(null, "P@ss0word");
}