public void MySql_ToFirstOrDefaultScalar_Works() { IDatabaseConnection connection = GetConnection(); InitializeDatabase(connection); var repo = new MySqlIntegrationRepository(GetConnection()); Assert.AreEqual((string)null, repo.ToFirstOrDefaultScalar()); }
public void MySql_SprocWithSchema_ThrowsException() { IDatabaseConnection connection = GetConnection(); InitializeDatabase(connection); var repo = new MySqlIntegrationRepository(GetConnection()); Assert.Throws <ArgumentException>(() => repo.SprocWithSchema()); }
public void MySql_ToScalar_Works() { IDatabaseConnection connection = GetConnection(); InitializeDatabase(connection); var repo = new MySqlIntegrationRepository(GetConnection()); Assert.AreEqual(142, repo.ToScalar()); }
public void MySql_InsertRecord_Works() { IDatabaseConnection connection = GetConnection(); InitializeDatabase(connection); var repo = new MySqlIntegrationRepository(GetConnection()); var result = repo.InsertRecord(); Assert.AreEqual(1, result); }
public void MySql_ManyManyTransactions_DoesntLeak() { IDatabaseConnection connection = GetConnection(); InitializeDatabase(connection); for (int ii = 0; ii < 1000; ii++) { var repo = new MySqlIntegrationRepository(GetConnection()); repo.SprocWithParameter(1); } }
public void MySql_SprocWithParameter_Works() { IDatabaseConnection connection = GetConnection(); InitializeDatabase(connection); var repo = new MySqlIntegrationRepository(GetConnection()); Assert.AreEqual(143, repo.SprocWithParameter(143)); }
public void MySql_InsertRecord_Works() { IDatabaseConnection connection = GetConnection(); InitializeDatabase(connection); var repo = new MySqlIntegrationRepository(GetConnection()); var result = repo.InsertRecord(); Assert.AreEqual(1, result); }
public void MySql_ManyManyTransactions_DoesntLeak() { IDatabaseConnection connection = GetConnection(); InitializeDatabase(connection); for (int ii = 0; ii < 1000; ii++) { var repo = new MySqlIntegrationRepository(GetConnection()); repo.SprocWithParameter(1); } }
public void MySql_CommitTransaction_HasSideEffect() { IDatabaseConnection connection = GetConnection(); InitializeDatabase(connection); var repo = new MySqlIntegrationRepository(GetConnection()); using (var transaction = repo.WithTransaction()) { repo.SprocWithSideEffect(); transaction.Commit(); } Assert.AreEqual(1, repo.GetCountOfSideEffects()); }
public void MySql_ToScalars_Works() { IDatabaseConnection connection = GetConnection(); InitializeDatabase(connection); var repo = new MySqlIntegrationRepository(GetConnection()); var result = repo.ToScalars(); Assert.AreEqual(3, result.Count); Assert.AreEqual(142, result[0]); Assert.AreEqual(143, result[1]); Assert.AreEqual(144, result[2]); }
public void MySql_RollbackTransaction_DoesntHaveSideEffect() { IDatabaseConnection connection = GetConnection(); InitializeDatabase(connection); var repo = new MySqlIntegrationRepository(GetConnection()); using (var transaction = repo.WithTransaction()) { repo.SprocWithSideEffect(); transaction.Rollback(); } Assert.AreEqual(0, repo.GetCountOfSideEffects()); }
public void MySql_CommitTransaction_HasSideEffect() { IDatabaseConnection connection = GetConnection(); InitializeDatabase(connection); var repo = new MySqlIntegrationRepository(GetConnection()); using (var transaction = repo.WithTransaction()) { repo.SprocWithSideEffect(); transaction.Commit(); } Assert.AreEqual(1, repo.GetCountOfSideEffects()); }
public void MySql_MultipleResultSets_Work() { IDatabaseConnection connection = GetConnection(); InitializeDatabase(connection); var repo = new MySqlIntegrationRepository(GetConnection()); var model = repo.ToMultipleResultSetModel(); Assert.AreEqual(model.ResultSet0.Count, 2); Assert.AreEqual(model.ResultSet0[0].IntValue, 147); Assert.AreEqual(model.ResultSet0[1].IntValue, 192); Assert.AreEqual(model.ResultSet0[0].BoolValue, true); Assert.AreEqual(model.ResultSet0[1].BoolValue, false); Assert.AreEqual(model.ResultSet1.Count, 2); Assert.AreEqual(model.ResultSet1[0].StringValue, "abc"); Assert.AreEqual(model.ResultSet1[1].StringValue, "def"); Assert.AreEqual(model.ResultSet1[0].DateTimeValue, new DateTime(2001, 2, 3)); Assert.AreEqual(model.ResultSet1[1].DateTimeValue, new DateTime(2004, 5, 6)); }
public void MySql_MultipleResultSets_Work() { IDatabaseConnection connection = GetConnection(); InitializeDatabase(connection); var repo = new MySqlIntegrationRepository(GetConnection()); var model = repo.ToMultipleResultSetModel(); Assert.AreEqual(model.ResultSet0.Count, 2); Assert.AreEqual(model.ResultSet0[0].IntValue, 147); Assert.AreEqual(model.ResultSet0[1].IntValue, 192); Assert.AreEqual(model.ResultSet0[0].BoolValue, true); Assert.AreEqual(model.ResultSet0[1].BoolValue, false); Assert.AreEqual(model.ResultSet1.Count, 2); Assert.AreEqual(model.ResultSet1[0].StringValue, "abc"); Assert.AreEqual(model.ResultSet1[1].StringValue, "def"); Assert.AreEqual(model.ResultSet1[0].DateTimeValue, new DateTime(2001, 2, 3)); Assert.AreEqual(model.ResultSet1[1].DateTimeValue, new DateTime(2004, 5, 6)); }
public void MySql_SprocWithSchema_ThrowsException() { IDatabaseConnection connection = GetConnection(); InitializeDatabase(connection); var repo = new MySqlIntegrationRepository(GetConnection()); Assert.Throws<ArgumentException>(() => repo.SprocWithSchema()); }
public void MySql_ToScalars_Works() { IDatabaseConnection connection = GetConnection(); InitializeDatabase(connection); var repo = new MySqlIntegrationRepository(GetConnection()); var result = repo.ToScalars(); Assert.AreEqual(3, result.Count); Assert.AreEqual(142, result[0]); Assert.AreEqual(143, result[1]); Assert.AreEqual(144, result[2]); }
public void MySql_ToScalar_Works() { IDatabaseConnection connection = GetConnection(); InitializeDatabase(connection); var repo = new MySqlIntegrationRepository(GetConnection()); Assert.AreEqual(142, repo.ToScalar()); }
public void MySql_RollbackTransaction_DoesntHaveSideEffect() { IDatabaseConnection connection = GetConnection(); InitializeDatabase(connection); var repo = new MySqlIntegrationRepository(GetConnection()); using (var transaction = repo.WithTransaction()) { repo.SprocWithSideEffect(); transaction.Rollback(); } Assert.AreEqual(0, repo.GetCountOfSideEffects()); }
public void MySql_SprocWithParameter_Works() { IDatabaseConnection connection = GetConnection(); InitializeDatabase(connection); var repo = new MySqlIntegrationRepository(GetConnection()); Assert.AreEqual(143, repo.SprocWithParameter(143)); }
public void MySql_ToFirstOrDefaultScalar_Works() { IDatabaseConnection connection = GetConnection(); InitializeDatabase(connection); var repo = new MySqlIntegrationRepository(GetConnection()); Assert.AreEqual((string)null, repo.ToFirstOrDefaultScalar()); }