Exemple #1
0
        public void ShouldMoveAroundTheBoard()
        {
            // Arrange
            Square[] realBoard = TestBoards.RealBoard();
            var      player    = new Player(Token.Automobile, "Test");
            var      dice      = Substitute.For <IDice>();

            dice.Roll().Returns(new RollResult(1, 2));
            // Act
            player.TakeTurn(dice, realBoard);

            // Assert
            player.CurrentSquare.Should().Be(3);
        }
Exemple #2
0
        public void ShouldBeAbleToBuyUnownedRailroad()
        {
            // Arrange
            Square[] realBoard = TestBoards.RealBoard();
            var      player    = new Player(Token.Automobile, "Test");
            var      dice      = Substitute.For <IDice>();

            dice.Roll().Returns(new RollResult(3, 2));
            // Act
            player.TakeTurn(dice, realBoard);

            // Assert
            player.Money.Should().Be(1300);
            realBoard[player.CurrentSquare].Owner.Should().Be(player);
        }
Exemple #3
0
        public void ShouldNotPayRentWhenYouOwnTheLocation()
        {
            // Arrange
            Square[] realBoard = TestBoards.RealBoard();
            var      player    = new Player(Token.Automobile, "Test");

            realBoard[3].Owner = player;
            var dice = Substitute.For <IDice>();

            dice.Roll().Returns(new RollResult(1, 2));

            // Act
            player.TakeTurn(dice, realBoard);

            // Assert
            player.Money.Should().Be(1500);
            realBoard[player.CurrentSquare].Owner.Should().Be(player);
        }
Exemple #4
0
        public void ShouldPayRentOnOwnedRailroad()
        {
            // Arrange
            Square[] realBoard = TestBoards.RealBoard();
            var      landlord  = new Player(Token.Battleship, "Landlord");

            realBoard[5].Owner = landlord;
            var player = new Player(Token.Automobile, "Test");
            var dice   = Substitute.For <IDice>();

            dice.Roll().Returns(new RollResult(3, 2));

            // Act
            player.TakeTurn(dice, realBoard);

            // Assert
            player.Money.Should().Be(1475);
            landlord.Money.Should().Be(1525);
            realBoard[player.CurrentSquare].Owner.Should().Be(landlord);
        }