public void DeleteUsingFaultyWhereClauseShouldThrowAndGiveSufficientInfo() { HopWhereClauseParseException hopException = null; try { GetSqlConnection().Hop().Delete <Beer>(whereClause: "UnknownField = 1"); } catch (HopWhereClauseParseException ex) { hopException = ex; } Assert.IsNotNull(hopException); Assert.IsNotNull(hopException.SqlException); Assert.IsNotNull(hopException.WhereClause); Assert.IsFalse(string.IsNullOrWhiteSpace(hopException.WhereClause)); }
public void ReadSingleWithFaultyWhereClauseShouldThrowAndExceptionShouldContainMoreInfo() { HopWhereClauseParseException exception = null; const string whereClause = "SomeCrazyNonExistingProperty = 1"; try { GetSqlConnection().Hop().Read <Beer>(whereClause); } catch (HopWhereClauseParseException ex) { exception = ex; } Assert.IsNotNull(exception); Assert.IsNotNull(exception.SqlException); Assert.IsFalse(string.IsNullOrWhiteSpace(exception.WhereClause)); }