public async Task GetAllTournaments_InputIsTournamentData_AllTournamentsReturned()
        {
            //Arrange
            tournamentRepositoryMock.Setup(tournamentRepository => tournamentRepository.GetAllEntitiesAsync()).ReturnsAsync(tournamentsContext);

            //Act
            var resultTournamentDTOs = (await tournamentService.GetAllTournamentsAsync()) as List <TournamentDTO>;

            //Assert
            Assert.IsNotNull(resultTournamentDTOs);
            Assert.AreEqual(tournamentsContext.Count, resultTournamentDTOs.Count);
        }
Exemplo n.º 2
0
        public async Task <ActionResult> GetAll()
        {
            var dtos = await tournamentService.GetAllTournamentsAsync();

            if (!dtos.Any())
            {
                return(NotFound());
            }
            else
            {
                return(Ok(dtos));
            }
        }
Exemplo n.º 3
0
 public async Task <IHttpActionResult> Get()
 {
     return(Json(await _tournamentService.GetAllTournamentsAsync()));
 }