Exception handling – C# Test Automation

Checking errors programmatically Use if, when you want to check something programmatically. You want to check everything programmatically that can be considered a normal part of execution. For example: if ( lCurrentConnection.State != ConnectionState.Closed ) {  lCurrentConnection.Close(); } or if ( lMyVar != null ) { lMyVar.DoSomething(); } else { lMyVar = InitMyVar(); lMyVar.DoSomething(); }…