Ejemplo n.º 1
0
        public void GetShip_From_ShipFactory_Of_Type_CounterTorpedo_Should_Return_new_CounterTorpedo()
        {
            ShipFactory    factory = new CounterTorpedoFactory();
            CounterTorpedo newShip = new CounterTorpedo();

            var res = factory.GetShip();

            Assert.True(res.Name == newShip.Name && res.Size == newShip.Size && res.ShipType == newShip.ShipType);
        }
Ejemplo n.º 2
0
        public void LostGame_With_Intact_Ship_Should_Return_False()
        {
            Player player = new Player();
            var    ship   = new CounterTorpedo();

            player.Ships.Add(ship);

            var res = player.LostGame;

            Assert.False(res);
        }
Ejemplo n.º 3
0
        public void PlaceShip_CounterTorpedo_From_Unoccuped_A1_Coordinates_To_Unoccuped_A3_Coordinates_Should_Return_True()
        {
            Player           player        = new Player();
            BoardCoordinates A1Coordinates = new BoardCoordinates(1, 1);
            BoardCoordinates A3Coordinates = new BoardCoordinates(1, 3);
            var ship = new CounterTorpedo();

            var res = player.PlaceShip(ship, A1Coordinates, A3Coordinates);

            Assert.True(res);
        }
Ejemplo n.º 4
0
        public void LostGame_With_Destroyed_Ship_Should_Return_True()
        {
            Player player = new Player();
            var    ship   = new CounterTorpedo()
            {
                Damages = 3
            };

            player.Ships.Add(ship);

            var res = player.LostGame;

            Assert.True(res);
        }
Ejemplo n.º 5
0
        public void PlaceShip_CounterTorpedo_From_Unoccuped_A1_Coordinates_To_Occuped_A3_Coordinates_Should_Return_True()
        {
            Player           player        = new Player();
            BoardCoordinates A1Coordinates = new BoardCoordinates(1, 1);
            BoardCoordinates A3Coordinates = new BoardCoordinates(1, 3);
            var A3Cell = player.PersonnalBoardGame.Cells.First(cell => cell.BoardCoordinates.Coordinates == A3Coordinates.Coordinates);

            A3Cell.CellOccupant = ShipType.AICRAFT_CARRIER;
            var ship = new CounterTorpedo();

            var res = player.PlaceShip(ship, A1Coordinates, A3Coordinates);

            Assert.False(res);
        }