1- //
1+ //
22// Copyright © Pete Sramek. All rights reserved.
33// Licensed under the MIT License. See LICENSE file in the project root for full license information.
44//
@@ -30,7 +30,7 @@ public void Encode_ListWithNullEncoder_ThrowsArgumentNullException()
3030 List < Coordinate > coordinates = [ new Coordinate ( 38.5 , - 120.2 ) ] ;
3131
3232 // Act & Assert
33- ArgumentNullException exception = Assert . ThrowsExactly < ArgumentNullException > ( ( ) => encoder ! . Encode ( coordinates ) ) ;
33+ ArgumentNullException exception = Assert . ThrowsExactly < ArgumentNullException > ( ( ) => PolylineEncoderExtensions . Encode ( encoder ! , coordinates ) ) ;
3434 Assert . AreEqual ( "encoder" , exception . ParamName ) ;
3535 }
3636
@@ -46,7 +46,7 @@ public void Encode_ListWithNullCoordinates_ThrowsArgumentNullException()
4646 List < Coordinate > ? coordinates = null ;
4747
4848 // Act & Assert
49- ArgumentNullException exception = Assert . ThrowsExactly < ArgumentNullException > ( ( ) => encoder . Encode ( coordinates ! ) ) ;
49+ ArgumentNullException exception = Assert . ThrowsExactly < ArgumentNullException > ( ( ) => PolylineEncoderExtensions . Encode ( encoder , coordinates ! ) ) ;
5050 Assert . AreEqual ( "coordinates" , exception . ParamName ) ;
5151 }
5252
@@ -68,7 +68,7 @@ public void Encode_ListWithValidEncoder_CallsEncoderWithCoordinatesFromList()
6868 PolylineEncoder encoder = new ( ) ;
6969
7070 // Act
71- Polyline result = encoder . Encode ( coordinates ) ;
71+ Polyline result = PolylineEncoderExtensions . Encode ( encoder , coordinates ) ;
7272
7373 // Assert
7474 Assert . AreEqual ( expectedPolyline , result ) ;
@@ -83,14 +83,10 @@ public void Encode_ListWithEmptyList_CallsEncoderWithEmptySpan()
8383 {
8484 // Arrange
8585 List < Coordinate > coordinates = [ ] ;
86- Polyline expectedPolyline = Polyline . FromString ( "" ) ;
8786 PolylineEncoder encoder = new ( ) ;
8887
89- // Act
90- Polyline result = encoder . Encode ( coordinates ) ;
91-
92- // Assert
93- Assert . AreEqual ( expectedPolyline , result ) ;
88+ // Act & Assert
89+ Assert . ThrowsExactly < ArgumentException > ( ( ) => PolylineEncoderExtensions . Encode ( encoder , coordinates ) ) ;
9490 }
9591
9692 /// <summary>
@@ -105,7 +101,7 @@ public void Encode_ArrayWithNullEncoder_ThrowsArgumentNullException()
105101 Coordinate [ ] coordinates = [ new Coordinate ( 38.5 , - 120.2 ) ] ;
106102
107103 // Act & Assert
108- ArgumentNullException exception = Assert . ThrowsExactly < ArgumentNullException > ( ( ) => encoder ! . Encode ( coordinates ) ) ;
104+ ArgumentNullException exception = Assert . ThrowsExactly < ArgumentNullException > ( ( ) => PolylineEncoderExtensions . Encode ( encoder ! , coordinates ) ) ;
109105 Assert . AreEqual ( "encoder" , exception . ParamName ) ;
110106 }
111107
@@ -137,13 +133,13 @@ public void Encode_ArrayWithValidEncoder_CallsEncoderWithCoordinatesFromArray()
137133 [
138134 new Coordinate ( 38.5 , - 120.2 ) ,
139135 new Coordinate ( 40.7 , - 120.95 ) ,
140- new Coordinate ( 43.252 , - 126.453 )
136+ new Coordinate ( 43.252 , - 126.453 ) ,
141137 ] ;
142138 Polyline expectedPolyline = Polyline . FromString ( "_p~iF~ps|U_ulLnnqC_mqNvxq`@" ) ;
143139 PolylineEncoder encoder = new ( ) ;
144140
145141 // Act
146- Polyline result = encoder . Encode ( coordinates ) ;
142+ Polyline result = PolylineEncoderExtensions . Encode ( encoder , coordinates ) ;
147143
148144 // Assert
149145 Assert . AreEqual ( expectedPolyline , result ) ;
@@ -158,13 +154,9 @@ public void Encode_ArrayWithEmptyArray_CallsEncoderWithEmptySpan()
158154 {
159155 // Arrange
160156 Coordinate [ ] coordinates = [ ] ;
161- Polyline expectedPolyline = Polyline . FromString ( "" ) ;
162157 PolylineEncoder encoder = new ( ) ;
163158
164- // Act
165- Polyline result = encoder . Encode ( coordinates ) ;
166-
167- // Assert
168- Assert . AreEqual ( expectedPolyline , result ) ;
159+ // Act & Assert
160+ Assert . ThrowsExactly < ArgumentException > ( ( ) => PolylineEncoderExtensions . Encode ( encoder , coordinates ) ) ;
169161 }
170162}
0 commit comments