Skip to content

Commit 0bc0bce

Browse files
Copilotpetesramek
andauthored
fix: update remaining coordinate references in code, log messages, and tests
Agent-Logs-Url: https://github.com/petesramek/polyline-algorithm-csharp/sessions/a91e90b4-cfd4-4daa-8202-ce52524fb335 Co-authored-by: petesramek <2333452+petesramek@users.noreply.github.com>
1 parent acb892a commit 0bc0bce

7 files changed

Lines changed: 21 additions & 21 deletions

File tree

src/PolylineAlgorithm/Internal/Defaults.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ internal static class Algorithm {
5353
/// <summary>
5454
/// Contains default values and constants for geographic value validation.
5555
/// </summary>
56-
internal static class Coordinate {
56+
internal static class Value {
5757
/// <summary>
5858
/// Provides constants representing latitude values, including the default, minimum, and maximum valid values.
5959
/// </summary>

src/PolylineAlgorithm/Internal/Diagnostics/ExceptionGuard.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,8 @@ internal static void ThrowBufferOverflow(string message) {
8282
[MethodImpl(MethodImplOptions.NoInlining)]
8383
#endif
8484
[DoesNotReturn]
85-
internal static void ThrowCoordinateValueOutOfRange(double value, double min, double max, string paramName) {
86-
throw new ArgumentOutOfRangeException(paramName, ExceptionMessage.FormatCoordinateValueMustBeBetween(paramName, min, max));
85+
internal static void ThrowValueOutOfRange(double value, double min, double max, string paramName) {
86+
throw new ArgumentOutOfRangeException(paramName, ExceptionMessage.FormatValueMustBeBetween(paramName, min, max));
8787
}
8888

8989
/// <summary>
@@ -271,7 +271,7 @@ internal static string FormatMalformedPolyline(long position) =>
271271
/// <summary>
272272
/// Formats a message indicating a value parameter must be within a range.
273273
/// </summary>
274-
internal static string FormatCoordinateValueMustBeBetween(string name, double min, double max) =>
274+
internal static string FormatValueMustBeBetween(string name, double min, double max) =>
275275
string.Format(CultureInfo.InvariantCulture, CoordinateValueMustBeBetweenFormat, name, min, max);
276276

277277
/// <summary>

src/PolylineAlgorithm/Internal/Diagnostics/LogDebugExtensions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,6 @@ internal static partial class LogDebugExtensions {
5252
/// <param name="latitude">The decoded latitude value.</param>
5353
/// <param name="longitude">The decoded longitude value.</param>
5454
/// <param name="position">The position in the polyline buffer at which the value was decoded.</param>
55-
[LoggerMessage(EVENT_ID_BASE + 4, LOG_LEVEL, "Decoded coordinate: (Latitude: {latitude}, Longitude: {longitude}) at position {position}.")]
55+
[LoggerMessage(EVENT_ID_BASE + 4, LOG_LEVEL, "Decoded value: (Latitude: {latitude}, Longitude: {longitude}) at position {position}.")]
5656
internal static partial void LogDecodedCoordinateDebug(this ILogger logger, double latitude, double longitude, int position);
5757
}

tests/PolylineAlgorithm.Tests/Extensions/PolylineEncoderExtensionsTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ public void Encode_With_Array_Null_Coordinates_Throws_ArgumentNullException() {
5959
// Act & Assert
6060
ArgumentNullException ex = Assert.ThrowsExactly<ArgumentNullException>(
6161
() => PolylineEncoderExtensions.Encode<(double, double), string>(encoder, coordinates!));
62-
Assert.AreEqual("coordinates", ex.ParamName);
62+
Assert.AreEqual("values", ex.ParamName);
6363
}
6464

6565
/// <summary>

tests/PolylineAlgorithm.Tests/Internal/Diagnostics/ExceptionGuardTests.cs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -54,18 +54,18 @@ public void ThrowBufferOverflow_With_Message_Throws_OverflowException() {
5454
}
5555

5656
/// <summary>
57-
/// Tests that ThrowCoordinateValueOutOfRange throws ArgumentOutOfRangeException with correct parameter name.
57+
/// Tests that ThrowValueOutOfRange throws ArgumentOutOfRangeException with correct parameter name.
5858
/// </summary>
5959
[TestMethod]
60-
public void ThrowCoordinateValueOutOfRange_With_Parameters_Throws_ArgumentOutOfRangeException() {
60+
public void ThrowValueOutOfRange_With_Parameters_Throws_ArgumentOutOfRangeException() {
6161
// Arrange
6262
const double value = 100.0;
6363
const double min = -90.0;
6464
const double max = 90.0;
6565
const string paramName = "latitude";
6666

6767
// Act & Assert
68-
var ex = Assert.ThrowsExactly<ArgumentOutOfRangeException>(() => ExceptionGuard.ThrowCoordinateValueOutOfRange(value, min, max, paramName));
68+
var ex = Assert.ThrowsExactly<ArgumentOutOfRangeException>(() => ExceptionGuard.ThrowValueOutOfRange(value, min, max, paramName));
6969
Assert.AreEqual(paramName, ex.ParamName);
7070
Assert.IsNotNull(ex.Message);
7171
}
@@ -288,17 +288,17 @@ public void FormatMalformedPolyline_With_Large_Position_Returns_Formatted_Messag
288288
}
289289

290290
/// <summary>
291-
/// Tests that FormatCoordinateValueMustBeBetween returns formatted message with all parameters.
291+
/// Tests that FormatValueMustBeBetween returns formatted message with all parameters.
292292
/// </summary>
293293
[TestMethod]
294-
public void FormatCoordinateValueMustBeBetween_With_Parameters_Returns_Formatted_Message() {
294+
public void FormatValueMustBeBetween_With_Parameters_Returns_Formatted_Message() {
295295
// Arrange
296296
const string name = "latitude";
297297
const double min = -90.0;
298298
const double max = 90.0;
299299

300300
// Act
301-
string result = ExceptionGuard.ExceptionMessage.FormatCoordinateValueMustBeBetween(name, min, max);
301+
string result = ExceptionGuard.ExceptionMessage.FormatValueMustBeBetween(name, min, max);
302302

303303
// Assert
304304
Assert.IsNotNull(result);
@@ -308,17 +308,17 @@ public void FormatCoordinateValueMustBeBetween_With_Parameters_Returns_Formatted
308308
}
309309

310310
/// <summary>
311-
/// Tests that FormatCoordinateValueMustBeBetween with positive values returns formatted message.
311+
/// Tests that FormatValueMustBeBetween with positive values returns formatted message.
312312
/// </summary>
313313
[TestMethod]
314-
public void FormatCoordinateValueMustBeBetween_With_Positive_Values_Returns_Formatted_Message() {
314+
public void FormatValueMustBeBetween_With_Positive_Values_Returns_Formatted_Message() {
315315
// Arrange
316316
const string name = "longitude";
317317
const double min = 0.0;
318318
const double max = 180.0;
319319

320320
// Act
321-
string result = ExceptionGuard.ExceptionMessage.FormatCoordinateValueMustBeBetween(name, min, max);
321+
string result = ExceptionGuard.ExceptionMessage.FormatValueMustBeBetween(name, min, max);
322322

323323
// Assert
324324
Assert.IsNotNull(result);
@@ -328,17 +328,17 @@ public void FormatCoordinateValueMustBeBetween_With_Positive_Values_Returns_Form
328328
}
329329

330330
/// <summary>
331-
/// Tests that FormatCoordinateValueMustBeBetween with fractional values returns formatted message.
331+
/// Tests that FormatValueMustBeBetween with fractional values returns formatted message.
332332
/// </summary>
333333
[TestMethod]
334-
public void FormatCoordinateValueMustBeBetween_With_Fractional_Values_Returns_Formatted_Message() {
334+
public void FormatValueMustBeBetween_With_Fractional_Values_Returns_Formatted_Message() {
335335
// Arrange
336336
const string name = "value";
337337
const double min = 1.5;
338338
const double max = 10.75;
339339

340340
// Act
341-
string result = ExceptionGuard.ExceptionMessage.FormatCoordinateValueMustBeBetween(name, min, max);
341+
string result = ExceptionGuard.ExceptionMessage.FormatValueMustBeBetween(name, min, max);
342342

343343
// Assert
344344
Assert.IsNotNull(result);

tests/PolylineAlgorithm.Tests/Internal/Diagnostics/LogDebugExtensionsTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ public void LogDecodedCoordinateDebug_With_Coordinates_And_Position_Logs_Decoded
9393

9494
Assert.HasCount(1, logger.Logs);
9595
Assert.AreEqual(LogLevel.Debug, logger.Logs[0].Level);
96-
Assert.Contains(string.Create(CultureInfo.InvariantCulture, $"Decoded coordinate: (Latitude: {latitude}, Longitude: {longitude}) at position {position}."), logger.Logs[0].Message, StringComparison.Ordinal);
96+
Assert.Contains(string.Create(CultureInfo.InvariantCulture, $"Decoded value: (Latitude: {latitude}, Longitude: {longitude}) at position {position}."), logger.Logs[0].Message, StringComparison.Ordinal);
9797
}
9898

9999
/// <summary>
@@ -155,7 +155,7 @@ public void LogDecodedCoordinateDebug_With_Zero_Coordinates_Logs_Message() {
155155

156156
Assert.HasCount(1, logger.Logs);
157157
Assert.AreEqual(LogLevel.Debug, logger.Logs[0].Level);
158-
Assert.Contains("Decoded coordinate", logger.Logs[0].Message, StringComparison.Ordinal);
158+
Assert.Contains("Decoded value", logger.Logs[0].Message, StringComparison.Ordinal);
159159
}
160160

161161
/// <summary>

tests/PolylineAlgorithm.Tests/Internal/Diagnostics/LogWarningExtensionsTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ public void LogInternalBufferOverflowWarning_Logs_Expected_Message() {
6969
public void LogCannotWriteValueToBufferWarning_Logs_Expected_Message() {
7070
var logger = new TestLogger();
7171
logger.LogCannotWriteValueToBufferWarning(4, 5);
72-
Assert.IsTrue(logger.Logs.Exists(l => l.Message.Contains("Cannot write to internal buffer at position 4. Current coordinate is at index 5.", StringComparison.Ordinal)));
72+
Assert.IsTrue(logger.Logs.Exists(l => l.Message.Contains("Cannot write to internal buffer at position 4. Current value is at index 5.", StringComparison.Ordinal)));
7373
}
7474

7575
/// <summary>

0 commit comments

Comments
 (0)