public void Polyliner_Decode_ShouldNotThrowException(string polyline) { // arrange var polyliner = new Polyliner(); // act var result = polyliner.Decode(polyline); // assert Assert.NotNull(result); }
[InlineData(@"xuekEl|inL", -33.45773, -70.67095)] // Sandiego public void Polyliner_Decode_ShouldReturnArray_WithOnePositionElement(string polyline, double latitude, double longitude) { // arrange var polyliner = new Polyliner(); // act var result = polyliner.Decode(polyline); // assert Assert.Equal(latitude, result[0].Latitude, 5); Assert.Equal(longitude, result[0].Longitude, 5); }
static public List <Coordinate> PolylineRoad(string polyline) { var polyliner = new Polyliner(); var result = polyliner.Decode(polyline); List <Coordinate> test = new List <Coordinate>(); for (int i = 0; i < result.Count; i++) { test.Add(ConvertorCoordinates.DegressToMeter(new Coordinate(result[i].Longitude, result[i].Latitude))); } return(test); }
[InlineData(-33.45773, -70.67095, "xuekEl|inL")] // Sandiego public void Polyliner_EncodeListWithOneElement_ShouldReturnExpectedPolyline(double latitude, double longitude, string expectedPolyline) { // arrange var polyliner = new Polyliner(); var points = new List <PolylinePoint> { new PolylinePoint(latitude, longitude) }; // act var result = polyliner.Encode(points); // assert Assert.NotNull(result); Assert.NotEmpty(result); Assert.Equal(expectedPolyline, result); }
public void Polyliner_EncodeGoogleExamples_ShouldReturnExpectedPolyline() { // arrange var polyliner = new Polyliner(); var points = new List <PolylinePoint> { new PolylinePoint(38.5, -120.2), new PolylinePoint(40.7, -120.95), new PolylinePoint(43.252, -126.453), }; // act var result = polyliner.Encode(points); // assert Assert.NotNull(result); Assert.NotEmpty(result); Assert.Equal(@"_p~iF~ps|U_ulLnnqC_mqNvxq`@", result); }
public void Polyliner_DecodeGoogleExamples_ShouldReturnArray_WithExpectedPositionsElement(string polyline) { // arrange var polyliner = new Polyliner(); // act var result = polyliner.Decode(polyline); // assert Assert.Equal(3, result.Count); Assert.Equal(38.5, result[0].Latitude, 5); Assert.Equal(-120.2, result[0].Longitude, 5); Assert.Equal(40.7, result[1].Latitude, 5); Assert.Equal(-120.95, result[1].Longitude, 5); Assert.Equal(43.252, result[2].Latitude, 5); Assert.Equal(-126.453, result[2].Longitude, 5); }