Example #1
0
        public void ShouldNotAddExistingPlayersAmongUsers()
        {
            var          topTenGame       = new mod.TopTenGame();
            const string playerToAddTwice = "New Player";

            List <string> expectedListOfPlayers = new List <string>
            {
                playerToAddTwice
            };

            topTenGame.RegisterUser(playerToAddTwice);
            topTenGame.RegisterUser(playerToAddTwice);

            topTenGame.Users.Should().BeEquivalentTo(expectedListOfPlayers);
        }
Example #2
0
        private static void Add5PlayersToGame(mod.TopTenGame topTenGame)
        {
            var players = GetArrayOfPlayers();

            foreach (string player in players)
            {
                topTenGame.RegisterUser(player);
            }
        }
Example #3
0
        public void ShouldCount1TopTenUsers()
        {
            var          topTenGame = new mod.TopTenGame();
            const string player     = "Player 1";

            topTenGame.RegisterUser(player);
            const int expectedNbOfUsers = 1;

            topTenGame.NbsUsers.Should().Be(expectedNbOfUsers);
        }
Example #4
0
        public void ShouldHaveCorrectCaptenAfter1Distribution()
        {
            var          topTenGame     = new mod.TopTenGame();
            const string expectedCapten = "The Capten";

            topTenGame.RegisterUser(expectedCapten);

            topTenGame.NextCapten();

            topTenGame.Capten.Should().Be(expectedCapten);
        }
Example #5
0
        public void ShouldRegisterTopTenUser()
        {
            //Given
            var topTenGame = new mod.TopTenGame();

            const string  player      = "Player 1";
            List <string> playersList = new List <string> {
                player
            };

            //With
            topTenGame.RegisterUser(player);

            //Then
            topTenGame.Users.Should().BeEquivalentTo(playersList);
        }
Example #6
0
        public void ShouldAddArrayOfNewPlayers()
        {
            var topTenGame = new mod.TopTenGame();

            Add5PlayersToGame(topTenGame);
            const string playerToAdd  = "New Player";
            var          playersToAdd = GetArrayOfPlayers().ToList();

            playersToAdd.Add(playerToAdd);

            List <string> expectedListOfPlayers = playersToAdd.ToList();

            topTenGame.RegisterUser(playersToAdd.ToArray());

            topTenGame.Users.Should().BeEquivalentTo(expectedListOfPlayers);
        }
Example #7
0
        public void ShouldResetTopTenGameParams()
        {
            //Given
            var         topTenGame = new mod.TopTenGame();
            const ulong idMsg      = 25;

            topTenGame.StoreRegisterMsg(idMsg);
            topTenGame.RegisterMsgId.Should().Be(idMsg);

            const string  theme      = "Thème 1";
            List <string> themesList = new List <string> {
                theme
            };

            topTenGame.RegisterTheme(theme);
            topTenGame.Themes.Should().BeEquivalentTo(themesList);

            const string  player      = "Player 1";
            List <string> playersList = new List <string> {
                player
            };

            topTenGame.RegisterUser(player);
            topTenGame.Users.Should().BeEquivalentTo(playersList);

            const ulong   expectedIdMsg       = 0;
            List <string> themesListExpected  = new List <string> {
            };
            List <string> playersListExpected = new List <string> {
            };

            const bool expectedCaptenPresence = false;

            topTenGame.NextCapten();

            //With
            topTenGame.Clear();

            //Then
            topTenGame.RegisterMsgId.Should().Be(expectedIdMsg);
            topTenGame.Themes.Should().BeEquivalentTo(themesListExpected);
            topTenGame.Users.Should().BeEquivalentTo(playersListExpected);
            topTenGame.HasCapten.Should().Be(expectedCaptenPresence);
        }