Esempio n. 1
0
        public void ShouldCount0TopTenUsers()
        {
            var       topTenGame        = new mod.TopTenGame();
            const int expectedNbOfUsers = 0;

            topTenGame.NbsUsers.Should().Be(expectedNbOfUsers);
        }
Esempio n. 2
0
        private static void Add5PlayersToGame(mod.TopTenGame topTenGame)
        {
            var players = GetArrayOfPlayers();

            foreach (string player in players)
            {
                topTenGame.RegisterUser(player);
            }
        }
Esempio n. 3
0
        public void ShouldCount5TopTenUsers()
        {
            var topTenGame = new mod.TopTenGame();

            Add5PlayersToGame(topTenGame);
            const int expectedNbOfUsers = 5;

            topTenGame.NbsUsers.Should().Be(expectedNbOfUsers);
        }
Esempio n. 4
0
        public void ShouldReturnTopTenThemeBuilder()
        {
            var args    = new mod.TopTenGame();
            var builder = srv.EmbedBuilderService.GenerateBuilderForNumberDisplay(args, "toto");

            var stringifiedBuilder = builder.ToStringCustom();

            stringifiedBuilder.Should().Be("TopTen, , #147786, , Le thème est le suivant :, toto, Le Cap'TEN est :, No Capten was selected, Tirage des numéros :, No players, ");
        }
Esempio n. 5
0
        public void ShouldNotHaveCaptenWithoutDistribution()
        {
            var topTenGame = new mod.TopTenGame();

            Add5PlayersToGame(topTenGame);
            const bool expectedCaptenPresence = false;

            topTenGame.HasCapten.Should().Be(expectedCaptenPresence);
        }
Esempio n. 6
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);
        }
Esempio n. 7
0
        public void ShouldReturnTopTenBuilder()
        {
            var args = new mod.TopTenGame();

            var builder = srv.EmbedBuilderService.InitBuilder(new List <EmbedFieldBuilder>(), args.ColorTopTen);

            var stringifiedBuilder = builder.ToStringCustom();

            stringifiedBuilder.Should().Be("TopTen, , #147786, , , ");
        }
Esempio n. 8
0
        public void ShouldCaptenBeFirstTopTenPlayer()
        {
            var topTenGame = new mod.TopTenGame();

            Add5PlayersToGame(topTenGame);
            const int expectedIndexCapten = 0;

            topTenGame.NextCapten();

            topTenGame.IndexCapten.Should().Be(expectedIndexCapten);
        }
Esempio n. 9
0
        public void ShouldHaveCaptenAfter1Distribution()
        {
            var topTenGame = new mod.TopTenGame();

            Add5PlayersToGame(topTenGame);
            const bool expectedCaptenPresence = true;

            topTenGame.NextCapten();

            topTenGame.HasCapten.Should().Be(expectedCaptenPresence);
        }
Esempio n. 10
0
        public void ShouldReturnTopTenPlayersBuilder()
        {
            var args    = new mod.TopTenGame();
            var builder = srv.EmbedBuilderService.GenerateBuilderReadRegister(new List <string> {
                "toto"
            }, args.ColorTopTen);

            var stringifiedBuilder = builder.ToStringCustom();

            stringifiedBuilder.Should().Be("TopTen, , #147786, , Liste des joueurs :, toto, ");
        }
Esempio n. 11
0
        public void ShouldAddArrayOfNewThemes()
        {
            var topTenGame  = new mod.TopTenGame();
            var themesToAdd = GetArrayOfThemes().ToList();

            List <string> expectedListOfThemes = themesToAdd.ToList();

            topTenGame.RegisterTheme(themesToAdd.ToArray());

            topTenGame.Themes.Should().BeEquivalentTo(expectedListOfThemes);
        }
Esempio n. 12
0
        public void ShouldHaveCorrectCaptenAfter1Distribution()
        {
            var          topTenGame     = new mod.TopTenGame();
            const string expectedCapten = "The Capten";

            topTenGame.RegisterUser(expectedCapten);

            topTenGame.NextCapten();

            topTenGame.Capten.Should().Be(expectedCapten);
        }
Esempio n. 13
0
        public void ShouldCaptenBeSecondTopTenPlayerAfter2Distributions()
        {
            var topTenGame = new mod.TopTenGame();

            Add5PlayersToGame(topTenGame);
            const int expectedIndexCapten = 1;

            topTenGame.NextCapten();
            topTenGame.NextCapten();

            topTenGame.IndexCapten.Should().Be(expectedIndexCapten);
        }
Esempio n. 14
0
        public void ShouldStoreTopTenRegisterMessage()
        {
            //Given
            var         topTenGame = new mod.TopTenGame();
            const ulong idMsg      = 25;

            //With
            topTenGame.StoreRegisterMsg(idMsg);

            //Then
            topTenGame.RegisterMsgId.Should().Be(idMsg);
        }
Esempio n. 15
0
        public void ShouldPopFirstTheme()
        {
            var           topTenGame         = new mod.TopTenGame();
            const string  expectedTheme      = "New theme";
            List <string> expectedThemesList = new List <string>();

            topTenGame.RegisterTheme(expectedTheme);

            string theme = topTenGame.GetNextTheme();

            theme.Should().Be(expectedTheme);
            topTenGame.Themes.Should().BeEquivalentTo(expectedThemesList);
        }
Esempio n. 16
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);
        }
Esempio n. 17
0
        public void ShouldRegisterTopTenTheme()
        {
            //Given
            var topTenGame = new mod.TopTenGame();

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

            //With
            topTenGame.RegisterTheme(theme);

            //Then
            topTenGame.Themes.Should().BeEquivalentTo(themesList);
        }
Esempio n. 18
0
        public void ShouldResetTopTenRegisterMessage()
        {
            //Given
            var         topTenGame = new mod.TopTenGame();
            const ulong idMsg      = 25;

            topTenGame.StoreRegisterMsg(idMsg);

            const ulong expectedIdMsg = 0;

            //With
            topTenGame.ResetRegisterMsg();

            //Then
            topTenGame.RegisterMsgId.Should().Be(expectedIdMsg);
        }
Esempio n. 19
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);
        }
Esempio n. 20
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);
        }
Esempio n. 21
0
        public void ShouldCaptenDistributionBeACircularPermutation()
        {
            var topTenGame = new mod.TopTenGame();

            Add5PlayersToGame(topTenGame);
            const int expectedIndexCapten = 0;

            topTenGame.NextCapten();
            topTenGame.NextCapten();
            topTenGame.NextCapten();
            topTenGame.NextCapten();
            topTenGame.NextCapten();
            topTenGame.NextCapten();

            topTenGame.IndexCapten.Should().Be(expectedIndexCapten);
        }
Esempio n. 22
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);
        }
Esempio n. 23
0
        public void ShouldReturnTopTenGameProperties()
        {
            // Given
            var topTenGame = new mod.TopTenGame();

            const string expectedColor = "#147786";

            int[]        expectationNumberList = new int[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, };
            const string expectedEmote         = "💯";
            int?         expectedIndexCapten   = null;
            const ulong  expectedIdMsg         = 0;

            // Then
            topTenGame.NumberList.Should().BeEquivalentTo(expectationNumberList);
            topTenGame.ColorTopTen.ToString().Should().Be(expectedColor);
            topTenGame.RegisterEmoteChar.ToString().Should().Be(expectedEmote);
            topTenGame.IndexCapten.Should().Be(expectedIndexCapten);
            topTenGame.RegisterMsgId.Should().Be(expectedIdMsg);
            topTenGame.Users.Should().BeEmpty();
            topTenGame.Themes.Should().BeEmpty();
        }