how to use assert.throws exception c# code example
Example 1: java define custom exception
public class CustomException extends Exception {
public CustomException(String errorMessage) {
super(errorMessage);
}
}
Example 2: test how catch exception c#
[TestMethod]
[ExpectedException(typeof(ArgumentException),
"A userId of null was inappropriately allowed.")]
public void NullUserIdInConstructor()
{
LogonInfo logonInfo = new LogonInfo(null, "P@ss0word");
}