private void RefreshTestsInfo() { try { var contextOptions = new DbContextOptionsBuilder <ApplicationDbContext>() .UseNpgsql(Configuration.GetConnectionString("DefaultConnection")); using (var db = new ApplicationDbContext(contextOptions.Options)) { var runs = new RunsProvider(db); runs.RefreshTestInfo().Wait(); } } catch (Exception e) { Console.WriteLine(e); throw; } }
private void GetResults() { try { var contextOptions = new DbContextOptionsBuilder <ApplicationDbContext>() .UseNpgsql(Configuration.GetConnectionString("DefaultConnection")); using (var db = new ApplicationDbContext(contextOptions.Options)) { var runsProvider = new RunsProvider(db); var results = runsProvider.GetAllTestsInfo().Result; using (var emailParser = new EmailParser(results.ToList())) { var reports = emailParser.GetReportAsync(); var runs = new RunsProvider(db); runs.AddMultipleRuns(reports).Wait(); } } } catch (Exception e) { Console.WriteLine(e); throw; } }