public void ParseShipsCoordinates_CorrectData_ReturnResults(string text, int count) { CoordinatesParser parser = Create(); IReadOnlyCollection <ShipDomainModel> results = parser.ParseShipsCoordinates(text); Assert.NotNull(results); Assert.Equal(count, results.Count); }
public void ParseShotCoordinate_CorrectData_ReturnResult(string text, int x, int y) { CoordinatesParser parser = Create(); ShotDomainModel result = parser.ParseCoordinate(text); Assert.NotNull(result); Assert.Equal(x, result.Point.X); Assert.Equal(y, result.Point.Y); }
public void ParseShipsCoordinates_CorrectData_ReturnCorrectResults(string text, int x1, int y1, int x2, int y2) { CoordinatesParser parser = Create(); IReadOnlyCollection <ShipDomainModel> results = parser.ParseShipsCoordinates(text); Assert.NotNull(results); Assert.Single(results); ShipDomainModel p = results.First(); Assert.Equal(Math.Min(x1, x2), p.Start.X); Assert.Equal(Math.Min(y1, y2), p.Start.Y); Assert.Equal(Math.Max(x1, x2), p.End.X); Assert.Equal(Math.Max(y1, y2), p.End.Y); }
public void ParseShipsCoordinates_IncorrectData_ThrowException(string text) { CoordinatesParser parser = Create(); Assert.Throws <DataValidationException>(() => parser.ParseShipsCoordinates(text)); }