Пример #1
0
        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);
            }
        }
Пример #2
0
        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);
        }
Пример #3
0
        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);
        }
Пример #4
0
        public void CannotCreatePlayerReferenceWithNullTournament()
        {
            PlayerReference playerReference = PlayerReference.Create("Maru", null);

            playerReference.Should().BeNull();
        }
Пример #5
0
        public void CannotCreatePlayerReferenceWithEmptyname()
        {
            PlayerReference playerReference = PlayerReference.Create("", tournament);

            playerReference.Should().BeNull();
        }