示例#1
0
        public void GetSizeToShow_With_3_Size_length_TorpedoBoat_Should_Return_string()
        {
            Ship ship = new TorpedoBoat();

            var res = ship.GetSizeToShow();

            Assert.IsType <string>(res);
        }
示例#2
0
        public void GetShip_From_ShipFactory_Of_Type_TorpedoBoat_Should_Return_new_TorpedoBoat()
        {
            ShipFactory factory = new TorpedoBoatFactory();
            TorpedoBoat newShip = new TorpedoBoat();

            var res = factory.GetShip();

            Assert.True(res.Name == newShip.Name && res.Size == newShip.Size && res.ShipType == newShip.ShipType);
        }
示例#3
0
        public void GetSizeToShow_With_3_Size_length_TorpedoBoat_Should_Return_string_With_Size_And_Name()
        {
            Ship   ship           = new TorpedoBoat();
            string expectedString = "Le Torpilleur mesure 2 cellules de longueur\r\n";

            var res = ship.GetSizeToShow();

            Assert.Equal(expectedString, res);
        }
        public void PlaceShipAtCoordinates_AircraftCarrier_At_Occuped_Should_Return_False()
        {
            BoardGame boardGame = new BoardGame();

            boardGame.InitBoardGame();
            var A1Coordinate   = new BoardCoordinates(1, 1);
            var A3Coordinate   = new BoardCoordinates(1, 3);
            var B3Coordinate   = new BoardCoordinates(2, 3);
            var A5Coordinate   = new BoardCoordinates(1, 5);
            var ship           = new AircraftCarrier();
            var occupationShip = new TorpedoBoat();

            boardGame.PlaceShipAtCoordinates(occupationShip, A3Coordinate, B3Coordinate);

            var res = boardGame.PlaceShipAtCoordinates(ship, A1Coordinate, A5Coordinate);

            Assert.False(res);
        }