Esempio n. 1
0
        public void VerticalCrossShotHitAndMiss()
        {
            var fireCrossShotCommand = new FireCrossShotCommand(new Point(1, 1), false);

            fireCrossShotCommand.PerformCommand(gameMap, player);

            var top    = opponentMap.Cells.First(cell => cell.X == 1 && cell.Y == 2);
            var right  = opponentMap.Cells.First(cell => cell.X == 2 && cell.Y == 1);
            var bottom = opponentMap.Cells.First(cell => cell.X == 1 && cell.Y == 0);
            var left   = opponentMap.Cells.First(cell => cell.X == 0 && cell.Y == 1);
            var middle = opponentMap.Cells.First(cell => cell.X == 1 && cell.Y == 1);

            Assert.IsTrue(top.Missed);
            Assert.IsTrue(right.Missed);
            Assert.IsTrue(bottom.Hit);
            Assert.IsTrue(left.Hit);
            Assert.IsTrue(middle.Missed);

            Assert.IsTrue(player.Energy == 8);
        }
Esempio n. 2
0
        public void DiagonalCrossShotHitAndMiss()
        {
            var fireCrossShotCommand = new FireCrossShotCommand(new Point(1, 1), true);

            fireCrossShotCommand.PerformCommand(gameMap, player);

            var topLeft  = opponentMap.Cells.First(cell => cell.X == 0 && cell.Y == 2);
            var topRight = opponentMap.Cells.First(cell => cell.X == 2 && cell.Y == 2);
            var botRight = opponentMap.Cells.First(cell => cell.X == 2 && cell.Y == 0);
            var botLeft  = opponentMap.Cells.First(cell => cell.X == 0 && cell.Y == 0);
            var middle   = opponentMap.Cells.First(cell => cell.X == 1 && cell.Y == 1);

            Assert.IsTrue(topLeft.Hit);
            Assert.IsTrue(botRight.Hit);
            Assert.IsTrue(botLeft.Hit);
            Assert.IsTrue(topRight.Missed);
            Assert.IsTrue(middle.Missed);

            Assert.IsTrue(player.Energy == 14);
        }