public void InflictDamageAt_WhenCalledWithInvalidCoordinate_ThrowsException()
        {
            var battleship = new Battleship(2, 2);

            Assert.ThrowsException <IndexOutOfRangeException>( // Before
                () => battleship.InflictDamageAt(new Coord {
                X = -1, Y = -1
            }));
            Assert.ThrowsException <IndexOutOfRangeException>( // Off row
                () => battleship.InflictDamageAt(new Coord {
                X = 2, Y = 1
            }));
            Assert.ThrowsException <IndexOutOfRangeException>( // After
                () => battleship.InflictDamageAt(new Coord {
                X = 2, Y = 2
            }));
        }
        public void Should_NotSink_WhenOneCellRepeatedlyDamaged()
        {
            var battleship = new Battleship(4, 1);

            for (var i = 0; i < 4; i++)
            {
                Assert.IsFalse(battleship.IsSunk());
                battleship.InflictDamageAt(new Coord {
                    X = 0, Y = 0
                });
            }
            Assert.IsFalse(battleship.IsSunk());
        }
        public void Should_Sink_OnlyWhenAllCellsDamaged()
        {
            var battleship = new Battleship(4, 1);

            for (var i = 0; i < 4; i++)
            {
                Assert.IsFalse(battleship.IsSunk());
                battleship.InflictDamageAt(new Coord {
                    X = i, Y = 0
                });
            }
            Assert.IsTrue(battleship.IsSunk());
        }