public void AllWorkersPlaced_GameMovesToActionPhase()
        {
            var game = new Game(NumberOfPlayers.Two);
            var firstPlayer = game.CurrentTurnPlayer;

            while (game.Players.Any(p => p.IdleWorkers > 0)) {
                game.PlaceWorkers();
            }

            game.CurrentPhase.Should().Be(Phase.Action);
            game.CurrentTurnPlayer.Should().Be(firstPlayer);
        }
        public GameViewModel()
        {
            var prop = DesignerProperties.IsInDesignModeProperty;
            bool isInDesignMode
                = (bool)DependencyPropertyDescriptor
                                .FromProperty(prop, typeof(FrameworkElement))
                                .Metadata.DefaultValue;

            if (isInDesignMode)
            {
                Game = new Game(NumberOfPlayers.Two);
            }
        }
        public void FourPlayerAllPlayersPlaceWorkers_PlacementReturnsToFirstPlayer()
        {
            var game = new Game(NumberOfPlayers.Four);
            var firstPlayer = game.CurrentTurnPlayer;

            game.PlaceWorkers();
            game.PlaceWorkers();
            game.PlaceWorkers();
            game.PlaceWorkers();
            game.CurrentTurnPlayer.Should().BeOfType<Player>();
            game.CurrentTurnPlayer.Should().Be(firstPlayer);
            game.CurrentPhase.Should().Be(Phase.Placement);
        }
        public void ActionTaken_IncreasesIdleWorkerCount()
        {
            var game = new Game(NumberOfPlayers.Two);

            // take game through Placement phase
            while (game.Players.Any(p => p.IdleWorkers > 0)) {
                game.PlaceWorkers();
            }

            int startsWith = game.CurrentTurnPlayer.IdleWorkers;
            game.ResolveAction();
            game.CurrentTurnPlayer.IdleWorkers.Should().BeGreaterThan(startsWith);
        }
        public void AllActionsTaken_GameMovesToFeedPhase()
        {
            var game = new Game(NumberOfPlayers.Two);

            // take game through Placement phase
            while (game.Players.Any(p => p.IdleWorkers > 0)) {
                game.PlaceWorkers();
            }

            while (game.Players.Any(p => p.AreAnyWorkersPlaced)) {
                game.ResolveAction();
            }

            game.CurrentTurnPlayer.Should().Be(game.StartPlayer);
            game.CurrentPhase.Should().Be(Phase.Feed);
        }
 public void StartGame(NumberOfPlayers numberOfPlayers)
 {
     Game = new Game(numberOfPlayers);
 }
 public void GameStart_BeginsWithPlacementPhase()
 {
     var game = new Game(NumberOfPlayers.Two);
     game.CurrentPhase.Should().Be(Phase.Placement);
 }
        public void GameSetup_PlayersStartWithFiveWorkers()
        {
            var game = new Game(NumberOfPlayers.Two);

            game.Players.Should().OnlyContain(p => p.IdleWorkers == 5);
        }
 public void GameBegins_OnFirstRound()
 {
     var game = new Game(NumberOfPlayers.Two);
     game.CurrentRound.Should().Be(1);
 }
        public void TwoPlayerGameSetup_YieldsTwoPlayerGame()
        {
            var game = new Game(NumberOfPlayers.Two);

            var message = "because the game was set up with 2 players";
            game.Players.ToList().Count.Should().Be(2, message);
            game.NumberOfPlayers.Should().Be(NumberOfPlayers.Two, message);
        }
        public void PlayerWorkersPlaced_IdleWorkerCountDecreases()
        {
            var game        = new Game(NumberOfPlayers.Two);
            var firstPlayer = game.CurrentTurnPlayer;
            int initCount   = firstPlayer.IdleWorkers;

            game.PlaceWorkers();
            firstPlayer.IdleWorkers.Should().BeLessThan(initCount);
        }
        public void PlayerTakesAllActions_NextPlayersTurn()
        {
            var game = new Game(NumberOfPlayers.Two);

            // take game through Placement phase
            while (game.Players.Any(p => p.IdleWorkers > 0)) {
                game.PlaceWorkers();
            }

            var initialPlayer = game.CurrentTurnPlayer;

            while (initialPlayer.AreAnyWorkersPlaced) {
                game.ResolveAction();
            }

            game.CurrentTurnPlayer.Should().NotBe(initialPlayer);
        }
        public void PlayerPlacesWorkers_TurnGoesToNextPlayer()
        {
            var game = new Game(NumberOfPlayers.Two);
            var firstPlayer = game.CurrentTurnPlayer;

            game.PlaceWorkers();
            game.CurrentTurnPlayer.Should().BeOfType<Player>();
            game.CurrentTurnPlayer.Should().NotBe(firstPlayer);
            game.CurrentPhase.Should().Be(Phase.Placement);
        }
 public void GameStart_TheStartPlayerGetsTheFirstTurn()
 {
     var game = new Game(NumberOfPlayers.Two);
     game.CurrentTurnPlayer.Should().Be(game.StartPlayer);
 }
 public void GameStart_OnePlayerIsTheStartPlayer()
 {
     var game = new Game(NumberOfPlayers.Two);
     game.StartPlayer.Should().NotBeNull();
     game.StartPlayer.Should().BeOfType<Player>();
 }