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); }
public async Task <ActionResult> GetAll() { var dtos = await tournamentService.GetAllTournamentsAsync(); if (!dtos.Any()) { return(NotFound()); } else { return(Ok(dtos)); } }
public async Task <IHttpActionResult> Get() { return(Json(await _tournamentService.GetAllTournamentsAsync())); }