Example #1
0
        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());
            }
        }
Example #3
0
        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"));
            }
        }
Example #4
0
        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);
            }
        }
Example #5
0
 public SpeedRunRepository(SpeedRunDatabaseContext context)
 {
     _context = context;
 }