public void GetSpeedRuns() { using (SpeedRunDatabaseContext context = new SpeedRunDatabaseContext()) { SpeedRunRepository repo = new SpeedRunRepository(context); IEnumerable <SpeedRun> speedRuns = repo.GetItems(); Assert.IsTrue(speedRuns != null && speedRuns.Any()); } }
public SpeedRunServiceResponse GetSpeedRuns(SpeedRunServiceRequest req) { try { using (SpeedRunDatabaseContext context = new SpeedRunDatabaseContext()) { SpeedRunRepository speedRunRepository = new SpeedRunRepository(context); SpeedRunService speedRunService = new SpeedRunService(speedRunRepository); IEnumerable <SpeedRun> speedRuns = speedRunService.GetAllSpeedRuns(); SpeedRunServiceResponse response = new SpeedRunServiceResponse(); response.SpeedRuns = speedRuns.ToArray(); return(response); } } catch (Exception exception) { SpeedRunServiceResponse response = new SpeedRunServiceResponse(); response.IsError = true; response.Message = exception.Message; return(response); } }