public void AllSunken() { var shootManager = new Implementations.ShootManager(); var ships = InitializeShips(); // Cruiser Sunken var shoot1 = new Position(2, 0); var shoot2 = new Position(2, 1); var shoot3 = new Position(2, 2); shootManager.RemoveHitPosition(shoot1, ships); shootManager.RemoveHitPosition(shoot2, ships); shootManager.RemoveHitPosition(shoot3, ships); // Destroyer Sunken var shoot4 = new Position(5, 1); var shoot5 = new Position(5, 2); shootManager.RemoveHitPosition(shoot4, ships); shootManager.RemoveHitPosition(shoot5, ships); // Submarine Sunken var shoot6 = new Position(8, 8); shootManager.RemoveHitPosition(shoot6, ships); var result = shootManager.IsAllShipsSunken(ships); result.Should().BeTrue(); }
public void NotSunken() { var shootManager = new Implementations.ShootManager(); var ships = InitializeShips(); var result = shootManager.IsAllShipsSunken(ships); result.Should().BeFalse(); }
public void Shoot10() { Implementations.ShootManager shootManager = new Implementations.ShootManager(); List <Ship> ships = AListShips(); Position iShoot = new Position(1, 0); shootManager.RemoveHitPosition(iShoot, ships); ships[1].Positions[0].X.Should().Be(1); ships[1].Positions[0].Y.Should().Be(1); }
public void Shoot21() { Implementations.ShootManager shootManager = new Implementations.ShootManager(); List <Ship> ships = AListShips(); Position iShoot1 = new Position(2, 0); Position iShoot2 = new Position(2, 1); Position iShoot3 = new Position(2, 2); shootManager.RemoveHitPosition(iShoot1, ships); shootManager.RemoveHitPosition(iShoot2, ships); shootManager.RemoveHitPosition(iShoot3, ships); ships[2].Positions.Count.Should().Be(0); }
public void Shoot00() { var shootManager = new Implementations.ShootManager(); List <Ship> ships = AListShips(); var iShoot = new Position(0, 0); shootManager.RemoveHitPosition(iShoot, ships); ships[0].Positions[0].X.Should().Be(0); ships[0].Positions[0].Y.Should().Be(1); bool result = ships[0].Positions.Contains(new Position(0, 0)); result.Should().BeFalse(); }
public void OneShipSunken() { var shootManager = new Implementations.ShootManager(); var ships = InitializeShips(); // Destroyer Sunken var shoot1 = new Position(5, 1); var shoot2 = new Position(5, 2); shootManager.RemoveHitPosition(shoot1, ships); shootManager.RemoveHitPosition(shoot2, ships); var result = shootManager.IsAllShipsSunken(ships); result.Should().BeFalse(); }