public async Task <IActionResult> Index(bool showFinished = false) { //Todo Remove in version 0.0.4 bugfix cause there ids with matchID0 await _matchSelectedTeamSteamIdentitiesService.RemoveFromMatch(0); var user = await _userservice.getUserFromCp(HttpContext.User); var servers = await _matchService.FindAllMatchesWhereTheUserHasRights(HttpContext.User, user); return(showFinished ? View(servers) : View(servers.Where(x => x.Status != Status.Finshed))); }
public void DefaultDB(bool teamMatch) { // arrange var pavlovServers = PavlovServerServiceTests.InitializePavlovServer(_sshServerSerivce, _pavlovServerService); pavlovServers.First().ServerType = ServerType.Event; _pavlovServerService.Upsert(pavlovServers.First()); var tmpMatch = CreateMatch(_matchService, pavlovServers.First(), teamMatch, _teamService, _steamIdentityService, _userManager, _matchSelectedSteamIdentitiesService, _matchSelectedTeamSteamIdentitiesService); // act var result = _matchService.FindOne(tmpMatch.Id).GetAwaiter().GetResult(); var result2 = _matchService.FindAll().GetAwaiter().GetResult(); result.Status = Status.Finshed; _matchService.Upsert(result).GetAwaiter().GetResult(); if (teamMatch) { var matchTeamSelectedSteamIdentities = _matchSelectedTeamSteamIdentitiesService.FindAll().GetAwaiter().GetResult(); //cause i added 2 matchTeamSelectedSteamIdentities.Should().HaveCount(2); var selected = _matchSelectedTeamSteamIdentitiesService.FindAllSelectedForMatchAndTeam(tmpMatch.Id, matchTeamSelectedSteamIdentities.First().TeamId).GetAwaiter().GetResult(); //cause i selected one per team selected.Should().HaveCount(1); _matchSelectedTeamSteamIdentitiesService.RemoveFromMatch(matchTeamSelectedSteamIdentities.First().Id) .GetAwaiter().GetResult(); matchTeamSelectedSteamIdentities = _matchSelectedTeamSteamIdentitiesService.FindAll().GetAwaiter().GetResult(); matchTeamSelectedSteamIdentities.Should().BeNullOrEmpty(); } else { var matchSelectedSteamIdentities = _matchSelectedSteamIdentitiesService.FindAll().GetAwaiter().GetResult(); matchSelectedSteamIdentities.Should().HaveCount(2); matchSelectedSteamIdentities = _matchSelectedSteamIdentitiesService.FindAllSelectedForMatch(tmpMatch.Id) .GetAwaiter().GetResult(); matchSelectedSteamIdentities.Should().HaveCount(2); _matchSelectedSteamIdentitiesService.RemoveFromMatch(tmpMatch.Id).GetAwaiter().GetResult(); matchSelectedSteamIdentities = _matchSelectedSteamIdentitiesService.FindAll().GetAwaiter().GetResult(); //cause i removed 1 matchSelectedSteamIdentities.Should().BeNullOrEmpty(); } var result3 = _matchService.CanBeDeleted(tmpMatch.Id).GetAwaiter().GetResult(); var result4 = _matchService.Delete(tmpMatch.Id).GetAwaiter().GetResult(); var result5 = _matchService.FindOne(tmpMatch.Id).GetAwaiter().GetResult(); // assert result.Should().NotBeNull(); result2.Should().HaveCount(1); result3.Should().BeTrue(); result4.Should().BeTrue(); result5.Should().BeNull(); }