Esempio n. 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());
            }
        }
Esempio n. 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"));
            }
        }
Esempio n. 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);
            }
        }
Esempio n. 5
0
 public SpeedRunRepository(SpeedRunDatabaseContext context)
 {
     _context = context;
 }