public void CanRenamePlayerReferenceInTournament() { InitializeRoundGroupAndPlayers(); string oldName = playerNames.First(); string newName = oldName + "-san"; using (TournamentRepository tournamentRepository = CreateTournamentRepository()) { Tournament tournament = tournamentRepository.GetTournamentByName(tournamentName); PlayerReference playerReference = tournament.GetPlayerReferenceByName(oldName); tournamentRepository.RenamePlayerReferenceInTournament(playerReference, newName); tournamentRepository.Save(); } using (TournamentRepository tournamentRepository = CreateTournamentRepository()) { Tournament tournament = tournamentRepository.GetTournamentByName(tournamentName); PlayerReference playerReference = tournament.GetPlayerReferenceByName(newName); playerReference.Should().NotBeNull(); playerReference.Name.Should().Be(newName); } }
public void CanGetPlayerInTournamentByPlayerName() { PlayerReference playerReference = tournament.RegisterPlayerReference("Maru"); PlayerReference fetchedPlayerReference = tournament.GetPlayerReferenceByName(playerReference.Name); fetchedPlayerReference.Should().NotBeNull(); fetchedPlayerReference.Id.Should().Be(playerReference.Id); fetchedPlayerReference.Name.Should().Be(playerReference.Name); }
public void CanCreatePlayerReference() { string name = "Maru"; PlayerReference playerReference = PlayerReference.Create(name, tournament); playerReference.Should().NotBeNull(); playerReference.Id.Should().NotBeEmpty(); playerReference.Name.Should().Be(name); playerReference.TournamentId.Should().Be(tournament.Id); playerReference.Tournament.Should().Be(tournament); }
public void CannotCreatePlayerReferenceWithNullTournament() { PlayerReference playerReference = PlayerReference.Create("Maru", null); playerReference.Should().BeNull(); }
public void CannotCreatePlayerReferenceWithEmptyname() { PlayerReference playerReference = PlayerReference.Create("", tournament); playerReference.Should().BeNull(); }