Exemple #1
0
        public void Add_AddsANewStartingPlayer()
        {
            var startingPlayer = new MockStartingPlayer();
            var player         = new MockPlayer();
            var mapper         = new StartingPlayerMapper();

            var actual = mapper.Add(startingPlayer, player);

            Assert.Equal(player, actual[startingPlayer]);
        }
Exemple #2
0
        public void Add_AddMultipleWithSameKey_ThrowsArgumentException()
        {
            var startingPlayer = new MockStartingPlayer();
            var player1        = new MockPlayer();
            var player2        = new MockPlayer();
            var mapper         = new StartingPlayerMapper();

            var actual = mapper.Add(startingPlayer, player1);

            Assert.Throws <ArgumentException>(() => actual.Add(startingPlayer, player2));
        }
Exemple #3
0
        public void Add_AddMultipleWithDifferentKey_ThrowsArgumentException()
        {
            var startingPlayer1 = new MockStartingPlayer();
            var startingPlayer2 = new MockStartingPlayer();
            var player1         = new MockPlayer();
            var player2         = new MockPlayer();
            var mapper          = new StartingPlayerMapper();

            var actual = mapper.Add(startingPlayer1, player1);

            actual = actual.Add(startingPlayer2, player2);

            Assert.Equal(player1, actual[startingPlayer1]);
            Assert.Equal(player2, actual[startingPlayer2]);
        }
Exemple #4
0
        public void Build_SetStartingPlayer()
        {
            var player1              = new MockPlayer();
            var player2              = new MockPlayer();
            var expectedPlayers      = new MockPlayers().CurrentReturns(player1);
            var startingPlayerMapper = new MockStartingPlayerMapper().AddReturnsItself().KeyReturns(player1);
            var players              = new MockPlayers().AddReturnsItself().SetCurrentPlayerReturns(expectedPlayers);
            var firstPlayerType      = new MockPlayerType().PlayerReturns(player1);
            var secondPlayerType     = new MockPlayerType().PlayerReturns(player2);
            var startingPlayer       = new MockStartingPlayer();
            var builder              = BuildGameBuilder(startingPlayerMapper, players, firstPlayerType: firstPlayerType, secondPlayerType: secondPlayerType, startingPlayer: startingPlayer);

            builder.Build();

            players.VerifySetCurrentPlayerCalled(player1);
            startingPlayerMapper.VerifyKeyCalled(startingPlayer);
        }