public void Ctor_ExceptionCreated_ContainsConnectionString() { NBiException nbiEx = null; // Open the connection using (var connection = new OleDbConnection()) { var connectionString = "CONNECTION STRING TO DISPLAY"; try { connection.ConnectionString = connectionString; } catch (ArgumentException ex) { nbiEx = Assert.Catch <NBiException>(delegate { throw new ConnectionException(ex, connectionString); }); } if (nbiEx == null) { Assert.Fail("An exception should have been thrown"); } else { //Test can continue Console.Out.WriteLine(nbiEx.Message); Assert.That(nbiEx.Message, Is.StringContaining(connectionString)); } } }
public CustomStackTraceErrorException(NBiException ex, string stackTrace) : base(ex.Message) { this.stackTrace = stackTrace; }