Beispiel #1
0
        public void WorkersAreHiredFromPoolFirst()
        {
            BoardState       game = DataTest.SampleGame;
            HireWorkerAction hire = new HireWorkerAction()
            {
                PlayerId = 0
            };

            int workersBefore = GameWorkersTest.UnhiredWorkersCount(game);

            Assert.AreEqual(2, workersBefore, "The test is written based on the assumption that there are exactly 2 workers free in the pool.");

            game = Tick.Apply(game, new List <GameAction> {
                hire
            });
            game = Tick.Apply(game, new List <GameAction> {
                hire
            });
            Assert.AreEqual(0, GameWorkersTest.UnhiredWorkersCount(game));

            Worker[] player2WorkersBefore = GameWorkersTest.GetPlayerWorkers(game, 1);
            game = Tick.Apply(game, new List <GameAction> {
                hire
            });
            Worker[] player2WorkersAfter = GameWorkersTest.GetPlayerWorkers(game, 1);

            Assert.AreEqual(player2WorkersBefore.Length - 1, player2WorkersAfter.Length);
        }
Beispiel #2
0
        public void FireWorkerActionWorks()
        {
            BoardState       game = DataTest.SampleGame;
            FireWorkerAction fire = new FireWorkerAction {
                PlayerId = 0
            };

            game = Tick.Apply(game, new List <GameAction> {
                fire
            });
            Assert.AreEqual(0, GameWorkersTest.GetPlayerWorkers(game, 0).Length);
        }