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

            _testClient = IntegrationTestServer.Start().CreateClient();
        }
Esempio n. 2
0
        public TimeEntryIntegrationTest()
        {
            Environment.SetEnvironmentVariable("VCAP_SERVICES", DbTestSupport.TestDbVcapJson);
            DbTestSupport.ExecuteSql("TRUNCATE TABLE time_entries");

            _testClient = IntegrationTestServer.Start().CreateClient();
        }
 public ManagementIntegrationTest()
 {
     Environment.SetEnvironmentVariable("MYSQL__CLIENT__CONNECTIONSTRING", DbTestSupport.TestDbConnectionString);
     Environment.SetEnvironmentVariable("MANAGEMENT__ENDPOINTS__PATH", "/cloudfoundryapplication");
     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);
        }
        public MySqlTimeEntryRepositoryTest()
        {
            Environment.SetEnvironmentVariable("MYSQL__CLIENT__CONNECTIONSTRING", DbTestSupport.TestDbConnectionString);
            DbTestSupport.ExecuteSql("TRUNCATE TABLE time_entries");
            DbTestSupport.ExecuteSql("TRUNCATE TABLE time_entries");

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

            _repository = new MySqlTimeEntryRepository(new TimeEntryContext(builder.Options));
        }
 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}"
     );
Esempio n. 9
0
 private async void Init()
 {
     Environment.SetEnvironmentVariable("MYSQL__CLIENT__CONNECTIONSTRING", DbTestSupport.TestDbConnectionString);
     DbTestSupport.ExecuteSql("TRUNCATE TABLE time_entries");
     _testClient = await IntegrationTestServer.GetHttpClient();
 }