public TimeEntryIntegrationTest() { Environment.SetEnvironmentVariable("MYSQL__CLIENT__CONNECTIONSTRING", DbTestSupport.TestDbConnectionString); DbTestSupport.ExecuteSql("TRUNCATE TABLE time_entries"); _testClient = IntegrationTestServer.Start().CreateClient(); }
public MySqlTimeEntryRepositoryTest() { DbTestSupport.ExecuteSql("TRUNCATE TABLE time_entries"); var builder = new DbContextOptionsBuilder <TimeEntryContext>() .UseMySql(DbTestSupport.TestDbConnectionString); _repository = new MySqlTimeEntryRepository(new TimeEntryContext(builder.Options)); }
private static void CreateInDb(TimeEntry timeEntry) { var sql = $@"INSERT INTO time_entries(id, project_id, user_id, date, hours) VALUES('{timeEntry.Id}', '{timeEntry.ProjectId}', '{timeEntry.UserId}', '{timeEntry.Date:yyyy-MM-dd}', '{timeEntry.Hours}')"; DbTestSupport.ExecuteSql(sql); }
private static IList <IDictionary <string, object> > FindAllInDb() => DbTestSupport.ExecuteSql( "SELECT id, project_id, user_id, date, hours FROM time_entries" );
private static IList <IDictionary <string, object> > FindInDb(long id) => DbTestSupport.ExecuteSql( $@"SELECT id, project_id, user_id, date, hours FROM time_entries WHERE id = {id}" );