public void AddMatchTest()
 {
     sportsRepo.Add(sport);
     teamsRepo.Add(teamA);
     teamsRepo.Add(teamB);
     serviceToTest.AddEncounter(matchAvsBDto);
     Assert.AreEqual(serviceToTest.GetAllEncounter().Count, 1);
 }
        public void GetAllEncountersNoDataAccessTest()
        {
            Mock <IEncounterRepository> fakeRepo = new Mock <IEncounterRepository>();

            fakeRepo.Setup(r => r.GetAll()).Throws(new DataInaccessibleException());
            serviceToTest = new EncounterService(fakeRepo.Object, teamsRepo, sportsRepo, usersRepo, auth.Object);
            serviceToTest.GetAllEncounter();
        }
Exemple #3
0
        public IActionResult Get([FromQuery] bool grouped)
        {
            ICollection <EncounterDto>      matches = encounterService.GetAllEncounter();
            ICollection <EncounterModelOut> output  = matches.Select(m => factory.CreateModelOut(m)).ToList();
            IActionResult result;

            if (grouped)
            {
                ICollection <EncounterCalendarModelOut> groupedBySportsAndDates = Group(output);
                result = Ok(groupedBySportsAndDates);
            }
            else
            {
                result = Ok(output);
            }
            return(result);
        }