public void GetGames() { using (SpeedRunDatabaseContext context = new SpeedRunDatabaseContext()) { GameRepository gameRepository = new GameRepository(context); IEnumerable <Game> games = gameRepository.GetItems(); Assert.IsTrue(games != null && games.Any()); } }
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 void GetGame() { const int targetId = 101; using (SpeedRunDatabaseContext context = new SpeedRunDatabaseContext()) { GameRepository gameRepository = new GameRepository(context); Game superMetroid = gameRepository.GetItem(targetId); Assert.IsTrue(superMetroid != null && superMetroid.Name.Contains("Metroid")); } }
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); } }
public SpeedRunRepository(SpeedRunDatabaseContext context) { _context = context; }