Exemplo n.º 1
0
        public void DoNotMoveCurrentPlayerIfInPenaltyBoxAndRollEvenDice()
        {
            const string player1Id = "p1Id";
            const string player2Id = "p2Id";
            var          game      = GetGame(
                new GameStarted("gameId", "name", GameCategories),
                new PlayerAdded(player1Id, "player1"),
                new CurrentPlayerChanged(player1Id),
                new PlayerAdded(player2Id, "player2"),
                new Moved(player1Id, 2),
                new QuestionAsked(1, "question", "answer"),
                new GoneToPenaltyBox(player1Id));
            var fakeDice = new FakeDice(2);
            var events   = game.Move(fakeDice, player1Id);

            Check.That(events).ContainsExactly(new CurrentPlayerChanged(player2Id));
        }
Exemplo n.º 2
0
        public void MoveCurrentPlayer()
        {
            const string playerId = "p1Id";
            var          game     = GetGame(
                new GameStarted("gameId", "name", GameCategories),
                new PlayerAdded(playerId, "player1"),
                new CurrentPlayerChanged(playerId),
                new PlayerAdded("p2Id", "player2"));
            var fakeDice = new FakeDice(2);

            var events = game.Move(fakeDice, playerId);

            var question = GameCategories.First().Questions.First().Question;

            Check.That(events).ContainsExactly(
                new Moved(playerId, 2),
                new QuestionAsked(question.Id, question.Text, question.Answer));
        }
Exemplo n.º 3
0
        public void MoveCurrentPlayerIfInPenaltyBoxButRollOddDice()
        {
            const string player1Id = "p1Id";
            const string player2Id = "p2Id";
            var          game      = GetGame(
                new GameStarted("gameId", "name", GameCategories),
                new PlayerAdded(player1Id, "player1"),
                new CurrentPlayerChanged(player1Id),
                new PlayerAdded(player2Id, "player2"),
                new Moved(player1Id, 2),
                new QuestionAsked(1, "question", "answer"),
                new GoneToPenaltyBox(player1Id)
                /* Bypass Player2 turn */);
            var fakeDice = new FakeDice(3);

            var events = game.Move(fakeDice, player1Id);

            var question = GameCategories.First().Questions.First().Question;

            Check.That(events).ContainsExactly(
                new GetOutOfPenaltyBox(player1Id),
                new Moved(player1Id, 5),
                new QuestionAsked(question.Id, question.Text, question.Answer));
        }