public void Should_ThrowValidationException_WhenInputIsInvalid(string input) { // Act var exception = Assert.Throws <ArgumentException>(() => ShotKeyInterpreter.GetGameField(input, gridSize: 10)); // Assert exception.Should().NotBeNull(); exception.Should().BeOfType <ArgumentException>(); }
public void Should_GetCorrectGameField_FromShotKey(string shotKey, int expectedX, int expectedY) { // Act var field = ShotKeyInterpreter.GetGameField(shotKey, gridSize: 10); // Assert field.Should().NotBeNull(); field.X.Should().Be(expectedX); field.Y.Should().Be(expectedY); }
public void Should_GetCorrectShotResult_WithSingleShot(string shotKey, ShotResultType shotResultType, ShipType?shipType = null) { // Arrange var expectedGameField = ShotKeyInterpreter.GetGameField(shotKey, _gameBoard.GridSize); // Act var shotResult = _gameBoard.ShootAt(shotKey); // Assert shotResult.Should().NotBeNull(); shotResult.ShotResultType.Should().Be(shotResultType); shotResult.ShipType.Should().Be(shipType); shotResult.GameField.Should().Be(expectedGameField); }
public ShotResult ShootAt(string shotKey) { var gameField = ShotKeyInterpreter.GetGameField(shotKey, GridSize); return(ShootAt(gameField)); }