Ejemplo 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());
            }
        }
Ejemplo n.º 2
0
        public void GetSpeedRuns()
        {
            using (SpeedRunDatabaseContext context = new SpeedRunDatabaseContext()) {
                SpeedRunRepository repo = new SpeedRunRepository(context);

                IEnumerable <SpeedRun> speedRuns = repo.GetItems();

                Assert.IsTrue(speedRuns != null && speedRuns.Any());
            }
        }
Ejemplo 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"));
            }
        }
Ejemplo 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);
            }
        }
Ejemplo n.º 5
0
 public SpeedRunRepository(SpeedRunDatabaseContext context)
 {
     _context = context;
 }