public void ExceptionHandling() { var customerBus = new busCustomer() { // Validates on Save automatically ErrorHandlingMode = ErrorHandlingModes.ThrowExecptions }; try { var custList = customerBus.ExecuteList <Customer>("select * from customerss where company like '%Wind%'"); } catch (SqlException ex) { Console.WriteLine("Error correctly thrown: " + customerBus.ErrorMessage); return; } Assert.IsTrue(false, "Exception should have fired and code should not get here."); }
public void ExceptionHandling() { var customerBus = new busCustomer() { ThrowExceptions = true }; try { // this should throw SqlException var custList = customerBus.ExecuteList <Customer>("select * from customerss where company like '%Wind%'"); } catch (SqlException ex) { Console.WriteLine("Error correctly thrown: " + customerBus.ErrorMessage); return; } Assert.IsTrue(false, "Exception should have fired and code should not get here."); }