@@ -66,12 +66,12 @@ public void Constructor_Parameterless_Ok() {
6666 [ DynamicData ( nameof ( Constructor_Valid_Parameters ) ) ]
6767 public void Constructor_Valid_Parameters_Ok ( double latitude , double longitude ) {
6868 // Arrange & Act
69- Coordinate result = new ( latitude , longitude ) ;
69+ Coordinate coordinate = new ( latitude , longitude ) ;
7070
7171 // Assert
72- Assert . IsFalse ( result . IsDefault ( ) ) ;
73- Assert . AreEqual ( latitude , result . Latitude ) ;
74- Assert . AreEqual ( longitude , result . Longitude ) ;
72+ Assert . IsFalse ( coordinate . IsDefault ( ) ) ;
73+ Assert . AreEqual ( latitude , coordinate . Latitude ) ;
74+ Assert . AreEqual ( longitude , coordinate . Longitude ) ;
7575 }
7676
7777 /// <summary>
@@ -119,11 +119,8 @@ public void Equals_Coordinate_True(double latitude, double longitude) {
119119 Coordinate @this = new ( latitude , longitude ) ;
120120 Coordinate other = new ( latitude , longitude ) ;
121121
122- // Act
123- bool result = @this . Equals ( other ) ;
124-
125- // Assert
126- Assert . IsTrue ( result ) ;
122+ // Act & Assert
123+ Assert . IsTrue ( @this . Equals ( other ) ) ;
127124 }
128125
129126 /// <summary>
@@ -138,11 +135,8 @@ public void Equals_Coordinate_False(double latitude, double longitude) {
138135 Coordinate @this = new ( latitude , longitude ) ;
139136 Coordinate other = new ( 0 , 0 ) ;
140137
141- // Act
142- bool result = @this . Equals ( other ) ;
143-
144- // Assert
145- Assert . IsFalse ( result ) ;
138+ // Act & Assert
139+ Assert . IsFalse ( @this . Equals ( other ) ) ;
146140 }
147141
148142 /// <summary>
@@ -151,8 +145,8 @@ public void Equals_Coordinate_False(double latitude, double longitude) {
151145 [ TestMethod ]
152146 public void Constructor_Latitude_OutOfRange_Throws ( ) {
153147 // Arrange & Act
154- void OverMaxLatitude ( ) => new Coordinate ( 91 , 0 ) ;
155- void UnderMinLatitude ( ) => new Coordinate ( - 91 , 0 ) ;
148+ static void OverMaxLatitude ( ) => new Coordinate ( 91 , 0 ) ;
149+ static void UnderMinLatitude ( ) => new Coordinate ( - 91 , 0 ) ;
156150
157151 // Assert
158152 Assert . ThrowsExactly < ArgumentOutOfRangeException > ( UnderMinLatitude ) ;
@@ -165,9 +159,8 @@ public void Constructor_Latitude_OutOfRange_Throws() {
165159 [ TestMethod ]
166160 public void Constructor_Longitude_OutOfRange_Throws ( ) {
167161 // Arrange & Act
168- void UnderMinLongitude ( ) => new Coordinate ( 0 , - 181 ) ;
169- void OverMaxLongitude ( ) => new Coordinate ( 0 , 181 ) ;
170-
162+ static void UnderMinLongitude ( ) => new Coordinate ( 0 , - 181 ) ;
163+ static void OverMaxLongitude ( ) => new Coordinate ( 0 , 181 ) ;
171164
172165 // Assert
173166 Assert . ThrowsExactly < ArgumentOutOfRangeException > ( UnderMinLongitude ) ;
@@ -181,19 +174,19 @@ public void Constructor_Longitude_OutOfRange_Throws() {
181174 public void Constructor_Boundary_Values_Ok ( ) {
182175 // Arrange
183176 const int MinLatitude = - 90 ;
184- const int MaxLatitude = 90 ;
185177 const int MinLongitude = - 180 ;
178+ const int MaxLatitude = 90 ;
186179 const int MaxLongitude = 180 ;
187180
188181 // Act
189- var coordinate1 = new Coordinate ( MaxLatitude , MaxLongitude ) ;
190- var coordinate2 = new Coordinate ( MinLatitude , MinLongitude ) ;
182+ Coordinate min = new ( MinLatitude , MinLongitude ) ;
183+ Coordinate max = new ( MaxLatitude , MaxLongitude ) ;
191184
192185 // Assert
193- Assert . AreEqual ( MaxLatitude , coordinate1 . Latitude ) ;
194- Assert . AreEqual ( MaxLongitude , coordinate1 . Longitude ) ;
195- Assert . AreEqual ( MinLatitude , coordinate2 . Latitude ) ;
196- Assert . AreEqual ( - MaxLongitude , coordinate2 . Longitude ) ;
186+ Assert . AreEqual ( MinLatitude , min . Latitude ) ;
187+ Assert . AreEqual ( - MaxLongitude , min . Longitude ) ;
188+ Assert . AreEqual ( MaxLatitude , max . Latitude ) ;
189+ Assert . AreEqual ( MaxLongitude , max . Longitude ) ;
197190 }
198191
199192 /// <summary>
@@ -202,7 +195,7 @@ public void Constructor_Boundary_Values_Ok() {
202195 [ TestMethod ]
203196 public void Equals_Object_True_And_False ( ) {
204197 // Arrange
205- var coordinate = new Coordinate ( 10 , 20 ) ;
198+ Coordinate coordinate = new ( 10 , 20 ) ;
206199 object equalCoordinate = new Coordinate ( 10 , 20 ) ;
207200 object notEqualCoordinate = new Coordinate ( 0 , 0 ) ;
208201 object notCoordinate = "not a coordinate" ;
@@ -220,30 +213,38 @@ public void Equals_Object_True_And_False() {
220213 /// </summary>
221214 [ TestMethod ]
222215 public void GetHashCode_Equal_For_Equal_Coordinates ( ) {
223- var coordinate1 = new Coordinate ( 10 , 20 ) ;
224- var coordinate2 = new Coordinate ( 10 , 20 ) ;
225- Assert . AreEqual ( coordinate1 . GetHashCode ( ) , coordinate2 . GetHashCode ( ) ) ;
216+ // Arrange
217+ Coordinate first = new ( 10 , 20 ) ;
218+ Coordinate second = new ( 10 , 20 ) ;
219+
220+ // Act & Assert
221+ Assert . AreEqual ( first . GetHashCode ( ) , second . GetHashCode ( ) ) ;
226222 }
227223
228224 /// <summary>
229225 /// Tests the <see cref="Coordinate.ToString"/> method for correct formatting.
230226 /// </summary>
231227 [ TestMethod ]
232228 public void ToString_Format_Ok ( ) {
233- var c = new Coordinate ( 12.34 , 56.78 ) ;
234- Assert . Contains ( "Latitude: 12.34" , c . ToString ( ) ) ;
235- Assert . Contains ( "Longitude: 56.78" , c . ToString ( ) ) ;
229+ /// Arrange
230+ var coordinate = new Coordinate ( 12.34 , 56.78 ) ;
231+
232+ // Act & Assert
233+ Assert . Contains ( "Latitude: 12.34" , coordinate . ToString ( ) ) ;
234+ Assert . Contains ( "Longitude: 56.78" , coordinate . ToString ( ) ) ;
236235 }
237236
238237 /// <summary>
239238 /// Tests the equality operators for the <see cref="Coordinate"/> type.
240239 /// </summary>
241240 [ TestMethod ]
242241 public void Equality_Operators_Ok ( ) {
243- var coordinate = new Coordinate ( 10 , 20 ) ;
244- var equalCoordinate = new Coordinate ( 10 , 20 ) ;
245- var notEqualCoordinate = new Coordinate ( 0 , 0 ) ;
242+ // Arrange
243+ Coordinate coordinate = new ( 10 , 20 ) ;
244+ Coordinate equalCoordinate = new ( 10 , 20 ) ;
245+ Coordinate notEqualCoordinate = new ( 0 , 0 ) ;
246246
247+ // Act & Assert
247248 Assert . IsTrue ( coordinate == equalCoordinate ) ;
248249 Assert . IsFalse ( coordinate != equalCoordinate ) ;
249250 Assert . IsTrue ( coordinate != notEqualCoordinate ) ;
0 commit comments