Check out example codes for "test how catch exception c#". It will help you in understanding the concepts better.

Code Example 1

[TestMethod]
[ExpectedException(typeof(ArgumentException),
    "A userId of null was inappropriately allowed.")]
public void NullUserIdInConstructor()
{
   LogonInfo logonInfo = new LogonInfo(null, "[email protected]");
}

Learn ReactJs, React Native from akashmittal.com