Ejemplo n.º 1
0
        public async Task ChangeActiveStatus_ShouldUpdateDatabase_WhenCanActivateTournament()
        {
            var tournamentId = 123;

            SetupMockTournamentRepositoryFlagCalls(new List <Tournament> {
            });

            await tournamentService.ChangeActiveStatus(tournamentId, true);

            VerifyMockTournamentRepositoryFlagCallsMadeWith(tournamentId, "IsActive", true);
        }
Ejemplo n.º 2
0
 public async Task <IActionResult> ChangeTournamentFlags([FromBody] ChangeTournamentFlagsRequest request)
 {
     if (!request.IsActive.HasValue && !request.IsOpenForRegistration.HasValue)
     {
         return(BadRequest("Must set at least one flag"));
     }
     try
     {
         if (request.IsActive.HasValue)
         {
             await tournamentService.ChangeActiveStatus(request.Id, request.IsActive.Value);
         }
         if (request.IsOpenForRegistration.HasValue)
         {
             await tournamentService.ChangeOpenForRegistrationStatus(request.Id, request.IsOpenForRegistration.Value);
         }
         return(Ok());
     }
     catch (Exception e)
     {
         return(StatusCode(StatusCodes.Status500InternalServerError, $"Bad time: {e.Message}"));
     }
 }