Exemplo n.º 1
0
        public TimeEntryIntegrationTest()
        {
            Environment.SetEnvironmentVariable("MYSQL__CLIENT__CONNECTIONSTRING", DbTestSupport.TestDbConnectionString);
            DbTestSupport.ExecuteSql("TRUNCATE TABLE time_entries");

            _testClient = IntegrationTestServer.Start().CreateClient();
        }
Exemplo n.º 2
0
        public MySqlTimeEntryRepositoryTest()
        {
            DbTestSupport.ExecuteSql("TRUNCATE TABLE time_entries");

            var builder = new DbContextOptionsBuilder <TimeEntryContext>()
                          .UseMySql(DbTestSupport.TestDbConnectionString);

            _repository = new MySqlTimeEntryRepository(new TimeEntryContext(builder.Options));
        }
Exemplo n.º 3
0
        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);
        }
Exemplo n.º 4
0
 private static IList <IDictionary <string, object> > FindAllInDb() => DbTestSupport.ExecuteSql(
     "SELECT id, project_id, user_id, date, hours FROM time_entries"
     );
Exemplo n.º 5
0
 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}"
     );