public void ShouldExecuteDeleteQueryForEachFilterSelect() { var queryExecutor = new Mock<IQueryExecutor>(); var filterStrategy = new UseFilterIfPresentStrategy(queryExecutor.Object, new NullLogger()); var select1 = new SqlTableSelect("1", null, false); var select2 = new SqlTableSelect( "2", null, false); queryExecutor.Setup(q => q.ExecuteNonQueryStatement("drop table 1")); queryExecutor.Setup(q => q.ExecuteNonQueryStatement("drop table 2")); filterStrategy.TearDownFilterTables(new List<SqlTableSelect> { select1, select2 }); queryExecutor.VerifyAll(); }
public void ShouldContinueThenThrowTearDownExceptionWhenDeleteFails() { var queryExecutor = new Mock<IQueryExecutor>(); var filterStrategy = new UseFilterIfPresentStrategy(queryExecutor.Object, new NullLogger()); var select1 = new SqlTableSelect("1", null, false); var select2 = new SqlTableSelect("2", null, false); queryExecutor.Setup(q => q.ExecuteNonQueryStatement("drop table 1")).Throws(new Exception()); queryExecutor.Setup(q => q.ExecuteNonQueryStatement("drop table 2")); try { filterStrategy.TearDownFilterTables(new List<SqlTableSelect> { select1, select2 }); throw new AssertionException("ExpectedException was not thrown"); } catch (TearDownException) { queryExecutor.VerifyAll(); } }