From 854591c59199e9541fb62f801b05467a953ac98f Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 3 Apr 2026 21:03:43 +0000 Subject: [PATCH 1/4] Rename test methods to all-words-underscore convention Apply new naming convention where every word in test method names is Title_Case and separated by an underscore across 10 test files: - AbstractPolylineDecoderTests.cs (5 renames) - AbstractPolylineEncoderTests.cs (8 renames) - InvalidPolylineExceptionTests.cs (2 renames) - PolylineEncodingTests.cs (31 renames) - PolylineEncodingOptionsBuilderTests.cs (23 renames) - PolylineDecoderExtensionsTests.cs (8 renames) - PolylineEncoderExtensionsTests.cs (6 renames) - LogDebugExtensionsTests.cs (12 renames) - LogWarningExtensionsTests.cs (8 renames) - ExceptionGuardTests.cs (39 renames) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Co-authored-by: petesramek <2333452+petesramek@users.noreply.github.com> --- .../AbstractPolylineDecoderTests.cs | 10 +-- .../AbstractPolylineEncoderTests.cs | 16 ++-- .../PolylineDecoderExtensionsTests.cs | 16 ++-- .../PolylineEncoderExtensionsTests.cs | 12 +-- .../Diagnostics/ExceptionGuardTests.cs | 76 +++++++++---------- .../Diagnostics/LogDebugExtensionsTests.cs | 24 +++--- .../Diagnostics/LogWarningExtensionsTests.cs | 16 ++-- .../InvalidPolylineExceptionTests.cs | 4 +- .../PolylineEncodingOptionsBuilderTests.cs | 46 +++++------ .../PolylineEncodingTests.cs | 62 +++++++-------- 10 files changed, 141 insertions(+), 141 deletions(-) diff --git a/tests/PolylineAlgorithm.Tests/Abstraction/AbstractPolylineDecoderTests.cs b/tests/PolylineAlgorithm.Tests/Abstraction/AbstractPolylineDecoderTests.cs index 037b3a9e..c6734c6c 100644 --- a/tests/PolylineAlgorithm.Tests/Abstraction/AbstractPolylineDecoderTests.cs +++ b/tests/PolylineAlgorithm.Tests/Abstraction/AbstractPolylineDecoderTests.cs @@ -70,7 +70,7 @@ public void Decode_With_Invalid_Character_Polyline_Throws_InvalidPolylineExcepti /// Tests that Decode with a valid polyline returns the expected coordinates. /// [TestMethod] - public void Decode_ValidPolyline_ReturnsExpectedCoordinates() { + public void Decode_With_Valid_Polyline_Returns_Expected_Coordinates() { // Arrange TestStringDecoder decoder = new(); string polyline = StaticValueProvider.Valid.GetPolyline(); @@ -91,7 +91,7 @@ public void Decode_ValidPolyline_ReturnsExpectedCoordinates() { /// Tests that the options constructor with null throws . /// [TestMethod] - public void Constructor_WithNullOptions_ThrowsArgumentNullException() { + public void Constructor_With_Null_Options_Throws_ArgumentNullException() { // Act & Assert ArgumentNullException ex = Assert.ThrowsExactly(() => new TestStringDecoderWithOptions(null!)); Assert.AreEqual("options", ex.ParamName); @@ -101,7 +101,7 @@ public void Constructor_WithNullOptions_ThrowsArgumentNullException() { /// Tests that the Options property returns the configured options. /// [TestMethod] - public void Options_Default_ReturnsDefaultOptions() { + public void Options_With_Default_Returns_Default_Options() { // Arrange TestStringDecoder decoder = new(); @@ -114,7 +114,7 @@ public void Options_Default_ReturnsDefaultOptions() { /// Tests that the options constructor stores the provided options. /// [TestMethod] - public void Constructor_WithOptions_StoresOptions() { + public void Constructor_With_Options_Stores_Options() { // Arrange PolylineEncodingOptions options = PolylineEncodingOptionsBuilder.Create() .WithPrecision(7) @@ -131,7 +131,7 @@ public void Constructor_WithOptions_StoresOptions() { /// Tests that Decode with a pre-cancelled token throws . /// [TestMethod] - public void Decode_PreCancelledToken_ThrowsOperationCanceledException() { + public void Decode_With_Pre_Cancelled_Token_Throws_OperationCanceledException() { // Arrange TestStringDecoder decoder = new(); string polyline = StaticValueProvider.Valid.GetPolyline(); diff --git a/tests/PolylineAlgorithm.Tests/Abstraction/AbstractPolylineEncoderTests.cs b/tests/PolylineAlgorithm.Tests/Abstraction/AbstractPolylineEncoderTests.cs index 9a79fa0e..f537dda2 100644 --- a/tests/PolylineAlgorithm.Tests/Abstraction/AbstractPolylineEncoderTests.cs +++ b/tests/PolylineAlgorithm.Tests/Abstraction/AbstractPolylineEncoderTests.cs @@ -30,7 +30,7 @@ public TestStringEncoder(PolylineEncodingOptions options) /// Tests that the default constructor creates an instance with default options. /// [TestMethod] - public void Constructor_Default_CreatesInstanceWithDefaultOptions() { + public void Constructor_With_Default_Options_Creates_Instance() { // Act TestStringEncoder encoder = new(); @@ -45,7 +45,7 @@ public void Constructor_Default_CreatesInstanceWithDefaultOptions() { /// Tests that the options constructor with null throws . /// [TestMethod] - public void Constructor_WithNullOptions_ThrowsArgumentNullException() { + public void Constructor_With_Null_Options_Throws_ArgumentNullException() { // Act & Assert ArgumentNullException ex = Assert.ThrowsExactly(() => new TestStringEncoder(null!)); Assert.AreEqual("options", ex.ParamName); @@ -55,7 +55,7 @@ public void Constructor_WithNullOptions_ThrowsArgumentNullException() { /// Tests that the options constructor stores the provided options. /// [TestMethod] - public void Constructor_WithOptions_StoresOptions() { + public void Constructor_With_Options_Stores_Options() { // Arrange PolylineEncodingOptions options = PolylineEncodingOptionsBuilder.Create() .WithPrecision(7) @@ -72,7 +72,7 @@ public void Constructor_WithOptions_StoresOptions() { /// Tests that Encode with an empty span throws . /// [TestMethod] - public void Encode_EmptySpan_ThrowsArgumentException() { + public void Encode_With_Empty_Span_Throws_ArgumentException() { // Arrange TestStringEncoder encoder = new(); @@ -84,7 +84,7 @@ public void Encode_EmptySpan_ThrowsArgumentException() { /// Tests that Encode with a single valid coordinate returns a non-empty string. /// [TestMethod] - public void Encode_SingleCoordinate_ReturnsNonEmptyString() { + public void Encode_With_Single_Coordinate_Returns_Non_Empty_String() { // Arrange TestStringEncoder encoder = new(); (double, double)[] coordinates = [(0.0, 0.0)]; @@ -101,7 +101,7 @@ public void Encode_SingleCoordinate_ReturnsNonEmptyString() { /// Tests that Encode with known coordinates returns the expected polyline string. /// [TestMethod] - public void Encode_KnownCoordinates_ReturnsExpectedPolyline() { + public void Encode_With_Known_Coordinates_Returns_Expected_Polyline() { // Arrange TestStringEncoder encoder = new(); (double Latitude, double Longitude)[] coordinates = [.. StaticValueProvider.Valid.GetCoordinates()]; @@ -118,7 +118,7 @@ public void Encode_KnownCoordinates_ReturnsExpectedPolyline() { /// Tests that Encode with a pre-cancelled token throws . /// [TestMethod] - public void Encode_PreCancelledToken_ThrowsOperationCanceledException() { + public void Encode_With_Pre_Cancelled_Token_Throws_OperationCanceledException() { // Arrange TestStringEncoder encoder = new(); using CancellationTokenSource cts = new(); @@ -134,7 +134,7 @@ public void Encode_PreCancelledToken_ThrowsOperationCanceledException() { /// limit, forcing heap allocation via . /// [TestMethod] - public void Encode_WithSmallStackAllocLimit_UsesHeapAllocationAndProducesCorrectResult() { + public void Encode_With_Small_Stack_Alloc_Limit_Uses_Heap_Allocation_And_Produces_Correct_Result() { // Arrange — force heap path by making stackAllocLimit smaller than any real encoding needs PolylineEncodingOptions options = PolylineEncodingOptionsBuilder.Create() .WithStackAllocLimit(1) diff --git a/tests/PolylineAlgorithm.Tests/Extensions/PolylineDecoderExtensionsTests.cs b/tests/PolylineAlgorithm.Tests/Extensions/PolylineDecoderExtensionsTests.cs index cdb15cd7..c44c914d 100644 --- a/tests/PolylineAlgorithm.Tests/Extensions/PolylineDecoderExtensionsTests.cs +++ b/tests/PolylineAlgorithm.Tests/Extensions/PolylineDecoderExtensionsTests.cs @@ -32,7 +32,7 @@ private sealed class TestMemoryDecoder : AbstractPolylineDecoder. /// [TestMethod] - public void Decode_CharArray_NullDecoder_ThrowsArgumentNullException() { + public void Decode_With_Char_Array_Null_Decoder_Throws_ArgumentNullException() { // Arrange IPolylineDecoder? decoder = null; char[] polyline = StaticValueProvider.Valid.GetPolyline().ToCharArray(); @@ -47,7 +47,7 @@ public void Decode_CharArray_NullDecoder_ThrowsArgumentNullException() { /// Tests that Decode with a null char array throws . /// [TestMethod] - public void Decode_CharArray_NullPolyline_ThrowsArgumentNullException() { + public void Decode_With_Char_Array_Null_Polyline_Throws_ArgumentNullException() { // Arrange TestStringDecoder decoder = new(); char[]? polyline = null; @@ -62,7 +62,7 @@ public void Decode_CharArray_NullPolyline_ThrowsArgumentNullException() { /// Tests that Decode with a valid char array returns expected coordinates. /// [TestMethod] - public void Decode_CharArray_ValidPolyline_ReturnsExpectedCoordinates() { + public void Decode_With_Char_Array_Valid_Polyline_Returns_Expected_Coordinates() { // Arrange TestStringDecoder decoder = new(); char[] polyline = StaticValueProvider.Valid.GetPolyline().ToCharArray(); @@ -85,7 +85,7 @@ public void Decode_CharArray_ValidPolyline_ReturnsExpectedCoordinates() { /// Tests that Decode with a null decoder throws . /// [TestMethod] - public void Decode_Memory_NullDecoder_ThrowsArgumentNullException() { + public void Decode_With_Memory_Null_Decoder_Throws_ArgumentNullException() { // Arrange IPolylineDecoder? decoder = null; ReadOnlyMemory polyline = StaticValueProvider.Valid.GetPolyline().AsMemory(); @@ -100,7 +100,7 @@ public void Decode_Memory_NullDecoder_ThrowsArgumentNullException() { /// Tests that Decode with a valid memory returns expected coordinates. /// [TestMethod] - public void Decode_Memory_ValidPolyline_ReturnsExpectedCoordinates() { + public void Decode_With_Memory_Valid_Polyline_Returns_Expected_Coordinates() { // Arrange TestStringDecoder decoder = new(); ReadOnlyMemory polyline = StaticValueProvider.Valid.GetPolyline().AsMemory(); @@ -123,7 +123,7 @@ public void Decode_Memory_ValidPolyline_ReturnsExpectedCoordinates() { /// Tests that Decode with a null decoder throws . /// [TestMethod] - public void Decode_String_NullDecoder_ThrowsArgumentNullException() { + public void Decode_With_String_Null_Decoder_Throws_ArgumentNullException() { // Arrange IPolylineDecoder, (double, double)>? decoder = null; string polyline = StaticValueProvider.Valid.GetPolyline(); @@ -138,7 +138,7 @@ public void Decode_String_NullDecoder_ThrowsArgumentNullException() { /// Tests that Decode with a null string throws . /// [TestMethod] - public void Decode_String_NullPolyline_ThrowsArgumentNullException() { + public void Decode_With_String_Null_Polyline_Throws_ArgumentNullException() { // Arrange TestMemoryDecoder decoder = new(); string? polyline = null; @@ -153,7 +153,7 @@ public void Decode_String_NullPolyline_ThrowsArgumentNullException() { /// Tests that Decode with a valid string returns expected coordinates. /// [TestMethod] - public void Decode_String_ValidPolyline_ReturnsExpectedCoordinates() { + public void Decode_With_String_Valid_Polyline_Returns_Expected_Coordinates() { // Arrange TestMemoryDecoder decoder = new(); string polyline = StaticValueProvider.Valid.GetPolyline(); diff --git a/tests/PolylineAlgorithm.Tests/Extensions/PolylineEncoderExtensionsTests.cs b/tests/PolylineAlgorithm.Tests/Extensions/PolylineEncoderExtensionsTests.cs index f1439b75..da8a622e 100644 --- a/tests/PolylineAlgorithm.Tests/Extensions/PolylineEncoderExtensionsTests.cs +++ b/tests/PolylineAlgorithm.Tests/Extensions/PolylineEncoderExtensionsTests.cs @@ -28,7 +28,7 @@ private sealed class TestStringEncoder : AbstractPolylineEncoder<(double Latitud /// Tests that Encode with a null encoder throws . /// [TestMethod] - public void Encode_List_NullEncoder_ThrowsArgumentNullException() { + public void Encode_With_List_Null_Encoder_Throws_ArgumentNullException() { // Arrange — use interface type so the extension method is resolved IPolylineEncoder<(double, double), string>? encoder = null; List<(double, double)> coordinates = [(0.0, 0.0)]; @@ -43,7 +43,7 @@ public void Encode_List_NullEncoder_ThrowsArgumentNullException() { /// Tests that Encode with a null list throws . /// [TestMethod] - public void Encode_List_NullCoordinates_ThrowsArgumentNullException() { + public void Encode_With_List_Null_Coordinates_Throws_ArgumentNullException() { // Arrange TestStringEncoder encoder = new(); List<(double, double)>? coordinates = null; @@ -58,7 +58,7 @@ public void Encode_List_NullCoordinates_ThrowsArgumentNullException() { /// Tests that Encode with a valid list returns the expected polyline. /// [TestMethod] - public void Encode_List_ValidCoordinates_ReturnsExpectedPolyline() { + public void Encode_With_List_Valid_Coordinates_Returns_Expected_Polyline() { // Arrange TestStringEncoder encoder = new(); List<(double Latitude, double Longitude)> coordinates = [.. StaticValueProvider.Valid.GetCoordinates()]; @@ -77,7 +77,7 @@ public void Encode_List_ValidCoordinates_ReturnsExpectedPolyline() { /// Tests that Encode with a null encoder throws . /// [TestMethod] - public void Encode_Array_NullEncoder_ThrowsArgumentNullException() { + public void Encode_With_Array_Null_Encoder_Throws_ArgumentNullException() { // Arrange — call the extension method explicitly because IPolylineEncoder.Encode(ReadOnlySpan) // would be preferred over the extension when calling through method syntax with an array argument. IPolylineEncoder<(double, double), string>? encoder = null; @@ -93,7 +93,7 @@ public void Encode_Array_NullEncoder_ThrowsArgumentNullException() { /// Tests that Encode with a null array throws . /// [TestMethod] - public void Encode_Array_NullCoordinates_ThrowsArgumentNullException() { + public void Encode_With_Array_Null_Coordinates_Throws_ArgumentNullException() { // Arrange — call the extension method explicitly (same reasoning as above). IPolylineEncoder<(double, double), string> encoder = new TestStringEncoder(); (double, double)[]? coordinates = null; @@ -108,7 +108,7 @@ public void Encode_Array_NullCoordinates_ThrowsArgumentNullException() { /// Tests that Encode with a valid array returns the expected polyline. /// [TestMethod] - public void Encode_Array_ValidCoordinates_ReturnsExpectedPolyline() { + public void Encode_With_Array_Valid_Coordinates_Returns_Expected_Polyline() { // Arrange TestStringEncoder encoder = new(); (double Latitude, double Longitude)[] coordinates = [.. StaticValueProvider.Valid.GetCoordinates()]; diff --git a/tests/PolylineAlgorithm.Tests/Internal/Diagnostics/ExceptionGuardTests.cs b/tests/PolylineAlgorithm.Tests/Internal/Diagnostics/ExceptionGuardTests.cs index 66fa84d4..b49e719a 100644 --- a/tests/PolylineAlgorithm.Tests/Internal/Diagnostics/ExceptionGuardTests.cs +++ b/tests/PolylineAlgorithm.Tests/Internal/Diagnostics/ExceptionGuardTests.cs @@ -17,7 +17,7 @@ public sealed class ExceptionGuardTests { /// Tests that ThrowNotFiniteNumber throws ArgumentOutOfRangeException with correct parameter name. /// [TestMethod] - public void ThrowNotFiniteNumber_WithParamName_ThrowsArgumentOutOfRangeException() { + public void ThrowNotFiniteNumber_With_Param_Name_Throws_ArgumentOutOfRangeException() { // Arrange const string paramName = "value"; @@ -31,7 +31,7 @@ public void ThrowNotFiniteNumber_WithParamName_ThrowsArgumentOutOfRangeException /// Tests that ThrowArgumentNull throws ArgumentNullException with correct parameter name. /// [TestMethod] - public void ThrowArgumentNull_WithParamName_ThrowsArgumentNullException() { + public void ThrowArgumentNull_With_Param_Name_Throws_ArgumentNullException() { // Arrange const string paramName = "input"; @@ -44,7 +44,7 @@ public void ThrowArgumentNull_WithParamName_ThrowsArgumentNullException() { /// Tests that ThrowBufferOverflow throws OverflowException with correct message. /// [TestMethod] - public void ThrowBufferOverflow_WithMessage_ThrowsOverflowException() { + public void ThrowBufferOverflow_With_Message_Throws_OverflowException() { // Arrange const string message = "Buffer overflow occurred."; @@ -57,7 +57,7 @@ public void ThrowBufferOverflow_WithMessage_ThrowsOverflowException() { /// Tests that ThrowCoordinateValueOutOfRange throws ArgumentOutOfRangeException with correct parameter name. /// [TestMethod] - public void ThrowCoordinateValueOutOfRange_WithParameters_ThrowsArgumentOutOfRangeException() { + public void ThrowCoordinateValueOutOfRange_With_Parameters_Throws_ArgumentOutOfRangeException() { // Arrange const double value = 100.0; const double min = -90.0; @@ -74,7 +74,7 @@ public void ThrowCoordinateValueOutOfRange_WithParameters_ThrowsArgumentOutOfRan /// Tests that StackAllocLimitMustBeEqualOrGreaterThan throws ArgumentOutOfRangeException with correct parameter name. /// [TestMethod] - public void StackAllocLimitMustBeEqualOrGreaterThan_WithParameters_ThrowsArgumentOutOfRangeException() { + public void StackAllocLimitMustBeEqualOrGreaterThan_With_Parameters_Throws_ArgumentOutOfRangeException() { // Arrange const int minValue = 10; const string paramName = "stackAllocLimit"; @@ -89,7 +89,7 @@ public void StackAllocLimitMustBeEqualOrGreaterThan_WithParameters_ThrowsArgumen /// Tests that ThrowArgumentCannotBeEmptyEnumerationMessage throws ArgumentException with correct parameter name. /// [TestMethod] - public void ThrowArgumentCannotBeEmptyEnumerationMessage_WithParamName_ThrowsArgumentException() { + public void ThrowArgumentCannotBeEmptyEnumerationMessage_With_Param_Name_Throws_ArgumentException() { // Arrange const string paramName = "collection"; @@ -103,7 +103,7 @@ public void ThrowArgumentCannotBeEmptyEnumerationMessage_WithParamName_ThrowsArg /// Tests that ThrowCouldNotWriteEncodedValueToBuffer throws InvalidOperationException with correct message. /// [TestMethod] - public void ThrowCouldNotWriteEncodedValueToBuffer_ThrowsInvalidOperationException() { + public void ThrowCouldNotWriteEncodedValueToBuffer_Throws_InvalidOperationException() { // Act & Assert var ex = Assert.ThrowsExactly(() => ExceptionGuard.ThrowCouldNotWriteEncodedValueToBuffer()); Assert.IsNotNull(ex.Message); @@ -113,7 +113,7 @@ public void ThrowCouldNotWriteEncodedValueToBuffer_ThrowsInvalidOperationExcepti /// Tests that ThrowDestinationArrayLengthMustBeEqualOrGreaterThanPolylineLength throws ArgumentException with correct parameter name. /// [TestMethod] - public void ThrowDestinationArrayLengthMustBeEqualOrGreaterThanPolylineLength_WithParameters_ThrowsArgumentException() { + public void ThrowDestinationArrayLengthMustBeEqualOrGreaterThanPolylineLength_With_Parameters_Throws_ArgumentException() { // Arrange const int destinationLength = 5; const int polylineLength = 10; @@ -129,7 +129,7 @@ public void ThrowDestinationArrayLengthMustBeEqualOrGreaterThanPolylineLength_Wi /// Tests that ThrowInvalidPolylineLength throws InvalidPolylineException with correct message. /// [TestMethod] - public void ThrowInvalidPolylineLength_WithParameters_ThrowsInvalidPolylineException() { + public void ThrowInvalidPolylineLength_With_Parameters_Throws_InvalidPolylineException() { // Arrange const int length = 5; const int min = 10; @@ -143,7 +143,7 @@ public void ThrowInvalidPolylineLength_WithParameters_ThrowsInvalidPolylineExcep /// Tests that ThrowInvalidPolylineCharacter throws InvalidPolylineException with correct message. /// [TestMethod] - public void ThrowInvalidPolylineCharacter_WithParameters_ThrowsInvalidPolylineException() { + public void ThrowInvalidPolylineCharacter_With_Parameters_Throws_InvalidPolylineException() { // Arrange const char character = '!'; const int position = 15; @@ -157,7 +157,7 @@ public void ThrowInvalidPolylineCharacter_WithParameters_ThrowsInvalidPolylineEx /// Tests that ThrowPolylineBlockTooLong throws InvalidPolylineException with correct message. /// [TestMethod] - public void ThrowPolylineBlockTooLong_WithPosition_ThrowsInvalidPolylineException() { + public void ThrowPolylineBlockTooLong_With_Position_Throws_InvalidPolylineException() { // Arrange const int position = 42; @@ -170,7 +170,7 @@ public void ThrowPolylineBlockTooLong_WithPosition_ThrowsInvalidPolylineExceptio /// Tests that ThrowInvalidPolylineFormat throws InvalidPolylineException with correct message. /// [TestMethod] - public void ThrowInvalidPolylineFormat_WithPosition_ThrowsInvalidPolylineException() { + public void ThrowInvalidPolylineFormat_With_Position_Throws_InvalidPolylineException() { // Arrange const long position = 100L; @@ -183,7 +183,7 @@ public void ThrowInvalidPolylineFormat_WithPosition_ThrowsInvalidPolylineExcepti /// Tests that ThrowInvalidPolylineBlockTerminator throws InvalidPolylineException with correct message. /// [TestMethod] - public void ThrowInvalidPolylineBlockTerminator_ThrowsInvalidPolylineException() { + public void ThrowInvalidPolylineBlockTerminator_Throws_InvalidPolylineException() { // Act & Assert var ex = Assert.ThrowsExactly(() => ExceptionGuard.ThrowInvalidPolylineBlockTerminator()); Assert.IsNotNull(ex.Message); @@ -193,7 +193,7 @@ public void ThrowInvalidPolylineBlockTerminator_ThrowsInvalidPolylineException() /// Tests that FormatStackAllocLimitMustBeEqualOrGreaterThan returns formatted message with specified value. /// [TestMethod] - public void FormatStackAllocLimitMustBeEqualOrGreaterThan_WithMinValue_ReturnsFormattedMessage() { + public void FormatStackAllocLimitMustBeEqualOrGreaterThan_With_Min_Value_Returns_Formatted_Message() { // Arrange const int minValue = 10; @@ -209,7 +209,7 @@ public void FormatStackAllocLimitMustBeEqualOrGreaterThan_WithMinValue_ReturnsFo /// Tests that FormatPolylineCannotBeShorterThan returns formatted message with specified values. /// [TestMethod] - public void FormatPolylineCannotBeShorterThan_WithLengthAndMinLength_ReturnsFormattedMessage() { + public void FormatPolylineCannotBeShorterThan_With_Length_And_Min_Length_Returns_Formatted_Message() { // Arrange const int length = 5; const int minLength = 10; @@ -227,7 +227,7 @@ public void FormatPolylineCannotBeShorterThan_WithLengthAndMinLength_ReturnsForm /// Tests that FormatMalformedPolyline returns formatted message with position. /// [TestMethod] - public void FormatMalformedPolyline_WithPosition_ReturnsFormattedMessage() { + public void FormatMalformedPolyline_With_Position_Returns_Formatted_Message() { // Arrange const long position = 42L; @@ -243,7 +243,7 @@ public void FormatMalformedPolyline_WithPosition_ReturnsFormattedMessage() { /// Tests that FormatMalformedPolyline with zero position returns formatted message. /// [TestMethod] - public void FormatMalformedPolyline_WithZeroPosition_ReturnsFormattedMessage() { + public void FormatMalformedPolyline_With_Zero_Position_Returns_Formatted_Message() { // Arrange const long position = 0L; @@ -259,7 +259,7 @@ public void FormatMalformedPolyline_WithZeroPosition_ReturnsFormattedMessage() { /// Tests that FormatMalformedPolyline with negative position returns formatted message. /// [TestMethod] - public void FormatMalformedPolyline_WithNegativePosition_ReturnsFormattedMessage() { + public void FormatMalformedPolyline_With_Negative_Position_Returns_Formatted_Message() { // Arrange const long position = -10L; @@ -275,7 +275,7 @@ public void FormatMalformedPolyline_WithNegativePosition_ReturnsFormattedMessage /// Tests that FormatMalformedPolyline with large position returns formatted message. /// [TestMethod] - public void FormatMalformedPolyline_WithLargePosition_ReturnsFormattedMessage() { + public void FormatMalformedPolyline_With_Large_Position_Returns_Formatted_Message() { // Arrange const long position = long.MaxValue; @@ -291,7 +291,7 @@ public void FormatMalformedPolyline_WithLargePosition_ReturnsFormattedMessage() /// Tests that FormatCoordinateValueMustBeBetween returns formatted message with all parameters. /// [TestMethod] - public void FormatCoordinateValueMustBeBetween_WithParameters_ReturnsFormattedMessage() { + public void FormatCoordinateValueMustBeBetween_With_Parameters_Returns_Formatted_Message() { // Arrange const string name = "latitude"; const double min = -90.0; @@ -311,7 +311,7 @@ public void FormatCoordinateValueMustBeBetween_WithParameters_ReturnsFormattedMe /// Tests that FormatCoordinateValueMustBeBetween with positive values returns formatted message. /// [TestMethod] - public void FormatCoordinateValueMustBeBetween_WithPositiveValues_ReturnsFormattedMessage() { + public void FormatCoordinateValueMustBeBetween_With_Positive_Values_Returns_Formatted_Message() { // Arrange const string name = "longitude"; const double min = 0.0; @@ -331,7 +331,7 @@ public void FormatCoordinateValueMustBeBetween_WithPositiveValues_ReturnsFormatt /// Tests that FormatCoordinateValueMustBeBetween with fractional values returns formatted message. /// [TestMethod] - public void FormatCoordinateValueMustBeBetween_WithFractionalValues_ReturnsFormattedMessage() { + public void FormatCoordinateValueMustBeBetween_With_Fractional_Values_Returns_Formatted_Message() { // Arrange const string name = "value"; const double min = 1.5; @@ -349,7 +349,7 @@ public void FormatCoordinateValueMustBeBetween_WithFractionalValues_ReturnsForma /// Tests that FormatPolylineBlockTooLong returns formatted message with position. /// [TestMethod] - public void FormatPolylineBlockTooLong_WithPosition_ReturnsFormattedMessage() { + public void FormatPolylineBlockTooLong_With_Position_Returns_Formatted_Message() { // Arrange const int position = 15; @@ -365,7 +365,7 @@ public void FormatPolylineBlockTooLong_WithPosition_ReturnsFormattedMessage() { /// Tests that FormatPolylineBlockTooLong with zero position returns formatted message. /// [TestMethod] - public void FormatPolylineBlockTooLong_WithZeroPosition_ReturnsFormattedMessage() { + public void FormatPolylineBlockTooLong_With_Zero_Position_Returns_Formatted_Message() { // Arrange const int position = 0; @@ -381,7 +381,7 @@ public void FormatPolylineBlockTooLong_WithZeroPosition_ReturnsFormattedMessage( /// Tests that FormatPolylineBlockTooLong with large position returns formatted message. /// [TestMethod] - public void FormatPolylineBlockTooLong_WithLargePosition_ReturnsFormattedMessage() { + public void FormatPolylineBlockTooLong_With_Large_Position_Returns_Formatted_Message() { // Arrange const int position = int.MaxValue; @@ -397,7 +397,7 @@ public void FormatPolylineBlockTooLong_WithLargePosition_ReturnsFormattedMessage /// Tests that FormatInvalidPolylineCharacter returns formatted message with character and position. /// [TestMethod] - public void FormatInvalidPolylineCharacter_WithCharacterAndPosition_ReturnsFormattedMessage() { + public void FormatInvalidPolylineCharacter_With_Character_And_Position_Returns_Formatted_Message() { // Arrange const char character = '!'; const int position = 10; @@ -415,7 +415,7 @@ public void FormatInvalidPolylineCharacter_WithCharacterAndPosition_ReturnsForma /// Tests that FormatInvalidPolylineCharacter with letter character returns formatted message. /// [TestMethod] - public void FormatInvalidPolylineCharacter_WithLetterCharacter_ReturnsFormattedMessage() { + public void FormatInvalidPolylineCharacter_With_Letter_Character_Returns_Formatted_Message() { // Arrange const char character = 'Z'; const int position = 5; @@ -433,7 +433,7 @@ public void FormatInvalidPolylineCharacter_WithLetterCharacter_ReturnsFormattedM /// Tests that FormatInvalidPolylineCharacter with special character returns formatted message. /// [TestMethod] - public void FormatInvalidPolylineCharacter_WithSpecialCharacter_ReturnsFormattedMessage() { + public void FormatInvalidPolylineCharacter_With_Special_Character_Returns_Formatted_Message() { // Arrange const char character = '@'; const int position = 0; @@ -451,7 +451,7 @@ public void FormatInvalidPolylineCharacter_WithSpecialCharacter_ReturnsFormatted /// Tests that FormatDestinationArrayLengthMustBeEqualOrGreaterThanPolylineLength returns formatted message. /// [TestMethod] - public void FormatDestinationArrayLengthMustBeEqualOrGreaterThanPolylineLength_WithLengths_ReturnsFormattedMessage() { + public void FormatDestinationArrayLengthMustBeEqualOrGreaterThanPolylineLength_With_Lengths_Returns_Formatted_Message() { // Arrange const int destinationLength = 5; const int polylineLength = 10; @@ -469,7 +469,7 @@ public void FormatDestinationArrayLengthMustBeEqualOrGreaterThanPolylineLength_W /// Tests that FormatDestinationArrayLengthMustBeEqualOrGreaterThanPolylineLength with zero destination length returns formatted message. /// [TestMethod] - public void FormatDestinationArrayLengthMustBeEqualOrGreaterThanPolylineLength_WithZeroDestinationLength_ReturnsFormattedMessage() { + public void FormatDestinationArrayLengthMustBeEqualOrGreaterThanPolylineLength_With_Zero_Destination_Length_Returns_Formatted_Message() { // Arrange const int destinationLength = 0; const int polylineLength = 100; @@ -487,7 +487,7 @@ public void FormatDestinationArrayLengthMustBeEqualOrGreaterThanPolylineLength_W /// Tests that FormatDestinationArrayLengthMustBeEqualOrGreaterThanPolylineLength with large values returns formatted message. /// [TestMethod] - public void FormatDestinationArrayLengthMustBeEqualOrGreaterThanPolylineLength_WithLargeValues_ReturnsFormattedMessage() { + public void FormatDestinationArrayLengthMustBeEqualOrGreaterThanPolylineLength_With_Large_Values_Returns_Formatted_Message() { // Arrange const int destinationLength = 1000; const int polylineLength = 2000; @@ -505,7 +505,7 @@ public void FormatDestinationArrayLengthMustBeEqualOrGreaterThanPolylineLength_W /// Tests that FormatInvalidPolylineLength returns formatted message with length and min values. /// [TestMethod] - public void FormatInvalidPolylineLength_WithLengthAndMin_ReturnsFormattedMessage() { + public void FormatInvalidPolylineLength_With_Length_And_Min_Returns_Formatted_Message() { // Arrange const int length = 5; const int min = 10; @@ -523,7 +523,7 @@ public void FormatInvalidPolylineLength_WithLengthAndMin_ReturnsFormattedMessage /// Tests that FormatInvalidPolylineLength with zero length returns formatted message. /// [TestMethod] - public void FormatInvalidPolylineLength_WithZeroLength_ReturnsFormattedMessage() { + public void FormatInvalidPolylineLength_With_Zero_Length_Returns_Formatted_Message() { // Arrange const int length = 0; const int min = 1; @@ -541,7 +541,7 @@ public void FormatInvalidPolylineLength_WithZeroLength_ReturnsFormattedMessage() /// Tests that FormatInvalidPolylineLength with negative values returns formatted message. /// [TestMethod] - public void FormatInvalidPolylineLength_WithNegativeValues_ReturnsFormattedMessage() { + public void FormatInvalidPolylineLength_With_Negative_Values_Returns_Formatted_Message() { // Arrange const int length = -5; const int min = 0; @@ -559,7 +559,7 @@ public void FormatInvalidPolylineLength_WithNegativeValues_ReturnsFormattedMessa /// Tests that GetArgumentValueMustBeFiniteNumber returns non-null message. /// [TestMethod] - public void GetArgumentValueMustBeFiniteNumber_ReturnsNonNullMessage() { + public void GetArgumentValueMustBeFiniteNumber_Returns_Non_Null_Message() { // Act string result = ExceptionGuard.ExceptionMessage.GetArgumentValueMustBeFiniteNumber(); @@ -572,7 +572,7 @@ public void GetArgumentValueMustBeFiniteNumber_ReturnsNonNullMessage() { /// Tests that GetCouldNotWriteEncodedValueToTheBuffer returns non-null message. /// [TestMethod] - public void GetCouldNotWriteEncodedValueToTheBuffer_ReturnsNonNullMessage() { + public void GetCouldNotWriteEncodedValueToTheBuffer_Returns_Non_Null_Message() { // Act string result = ExceptionGuard.ExceptionMessage.GetCouldNotWriteEncodedValueToTheBuffer(); @@ -585,7 +585,7 @@ public void GetCouldNotWriteEncodedValueToTheBuffer_ReturnsNonNullMessage() { /// Tests that GetArgumentCannotBeEmpty returns non-null message. /// [TestMethod] - public void GetArgumentCannotBeEmpty_ReturnsNonNullMessage() { + public void GetArgumentCannotBeEmpty_Returns_Non_Null_Message() { // Act string result = ExceptionGuard.ExceptionMessage.GetArgumentCannotBeEmpty(); @@ -598,7 +598,7 @@ public void GetArgumentCannotBeEmpty_ReturnsNonNullMessage() { /// Tests that GetInvalidPolylineBlockTerminator returns non-null message. /// [TestMethod] - public void GetInvalidPolylineBlockTerminator_ReturnsNonNullMessage() { + public void GetInvalidPolylineBlockTerminator_Returns_Non_Null_Message() { // Act string result = ExceptionGuard.ExceptionMessage.GetInvalidPolylineBlockTerminator(); diff --git a/tests/PolylineAlgorithm.Tests/Internal/Diagnostics/LogDebugExtensionsTests.cs b/tests/PolylineAlgorithm.Tests/Internal/Diagnostics/LogDebugExtensionsTests.cs index 14cc2bd4..0dff7193 100644 --- a/tests/PolylineAlgorithm.Tests/Internal/Diagnostics/LogDebugExtensionsTests.cs +++ b/tests/PolylineAlgorithm.Tests/Internal/Diagnostics/LogDebugExtensionsTests.cs @@ -38,7 +38,7 @@ public void Dispose() { } /// Tests that LogOperationStartedDebug WithOperationName LogsStartedMessage. /// [TestMethod] - public void LogOperationStartedDebug_WithOperationName_LogsStartedMessage() { + public void LogOperationStartedDebug_With_Operation_Name_Logs_Started_Message() { var logger = new TestLogger(); const string operationName = "TestOperation"; @@ -53,7 +53,7 @@ public void LogOperationStartedDebug_WithOperationName_LogsStartedMessage() { /// Tests that LogOperationFailedDebug WithOperationName LogsFailedMessage. /// [TestMethod] - public void LogOperationFailedDebug_WithOperationName_LogsFailedMessage() { + public void LogOperationFailedDebug_With_Operation_Name_Logs_Failed_Message() { var logger = new TestLogger(); const string operationName = "TestOperation"; @@ -68,7 +68,7 @@ public void LogOperationFailedDebug_WithOperationName_LogsFailedMessage() { /// Tests that LogOperationFinishedDebug WithOperationName LogsFinishedMessage. /// [TestMethod] - public void LogOperationFinishedDebug_WithOperationName_LogsFinishedMessage() { + public void LogOperationFinishedDebug_With_Operation_Name_Logs_Finished_Message() { var logger = new TestLogger(); const string operationName = "TestOperation"; @@ -83,7 +83,7 @@ public void LogOperationFinishedDebug_WithOperationName_LogsFinishedMessage() { /// Tests that LogDecodedCoordinateDebug WithCoordinatesAndPosition LogsDecodedCoordinateMessage. /// [TestMethod] - public void LogDecodedCoordinateDebug_WithCoordinatesAndPosition_LogsDecodedCoordinateMessage() { + public void LogDecodedCoordinateDebug_With_Coordinates_And_Position_Logs_Decoded_Coordinate_Message() { var logger = new TestLogger(); const double latitude = 38.5; const double longitude = -120.2; @@ -100,7 +100,7 @@ public void LogDecodedCoordinateDebug_WithCoordinatesAndPosition_LogsDecodedCoor /// Tests that LogOperationStartedDebug WithNullOperationName LogsMessage. /// [TestMethod] - public void LogOperationStartedDebug_WithNullOperationName_LogsMessage() { + public void LogOperationStartedDebug_With_Null_Operation_Name_Logs_Message() { var logger = new TestLogger(); const string? operationName = null; @@ -115,7 +115,7 @@ public void LogOperationStartedDebug_WithNullOperationName_LogsMessage() { /// Tests that LogOperationFailedDebug WithNullOperationName LogsMessage. /// [TestMethod] - public void LogOperationFailedDebug_WithNullOperationName_LogsMessage() { + public void LogOperationFailedDebug_With_Null_Operation_Name_Logs_Message() { var logger = new TestLogger(); const string? operationName = null; @@ -130,7 +130,7 @@ public void LogOperationFailedDebug_WithNullOperationName_LogsMessage() { /// Tests that LogOperationFinishedDebug WithNullOperationName LogsMessage. /// [TestMethod] - public void LogOperationFinishedDebug_WithNullOperationName_LogsMessage() { + public void LogOperationFinishedDebug_With_Null_Operation_Name_Logs_Message() { var logger = new TestLogger(); const string? operationName = null; @@ -145,7 +145,7 @@ public void LogOperationFinishedDebug_WithNullOperationName_LogsMessage() { /// Tests that LogDecodedCoordinateDebug WithZeroCoordinates LogsMessage. /// [TestMethod] - public void LogDecodedCoordinateDebug_WithZeroCoordinates_LogsMessage() { + public void LogDecodedCoordinateDebug_With_Zero_Coordinates_Logs_Message() { var logger = new TestLogger(); const double latitude = 0.0; const double longitude = 0.0; @@ -162,7 +162,7 @@ public void LogDecodedCoordinateDebug_WithZeroCoordinates_LogsMessage() { /// Tests that LogDecodedCoordinateDebug WithNegativeCoordinates LogsMessage. /// [TestMethod] - public void LogDecodedCoordinateDebug_WithNegativeCoordinates_LogsMessage() { + public void LogDecodedCoordinateDebug_With_Negative_Coordinates_Logs_Message() { var logger = new TestLogger(); const double latitude = -90.0; const double longitude = -180.0; @@ -179,7 +179,7 @@ public void LogDecodedCoordinateDebug_WithNegativeCoordinates_LogsMessage() { /// Tests that LogOperationStartedDebug WithEmptyOperationName LogsMessage. /// [TestMethod] - public void LogOperationStartedDebug_WithEmptyOperationName_LogsMessage() { + public void LogOperationStartedDebug_With_Empty_Operation_Name_Logs_Message() { var logger = new TestLogger(); string operationName = string.Empty; @@ -194,7 +194,7 @@ public void LogOperationStartedDebug_WithEmptyOperationName_LogsMessage() { /// Tests that LogOperationFailedDebug WithEmptyOperationName LogsMessage. /// [TestMethod] - public void LogOperationFailedDebug_WithEmptyOperationName_LogsMessage() { + public void LogOperationFailedDebug_With_Empty_Operation_Name_Logs_Message() { var logger = new TestLogger(); string operationName = string.Empty; @@ -209,7 +209,7 @@ public void LogOperationFailedDebug_WithEmptyOperationName_LogsMessage() { /// Tests that LogOperationFinishedDebug WithEmptyOperationName LogsMessage. /// [TestMethod] - public void LogOperationFinishedDebug_WithEmptyOperationName_LogsMessage() { + public void LogOperationFinishedDebug_With_Empty_Operation_Name_Logs_Message() { var logger = new TestLogger(); string operationName = string.Empty; diff --git a/tests/PolylineAlgorithm.Tests/Internal/Diagnostics/LogWarningExtensionsTests.cs b/tests/PolylineAlgorithm.Tests/Internal/Diagnostics/LogWarningExtensionsTests.cs index a4dc4912..5f19cc8e 100644 --- a/tests/PolylineAlgorithm.Tests/Internal/Diagnostics/LogWarningExtensionsTests.cs +++ b/tests/PolylineAlgorithm.Tests/Internal/Diagnostics/LogWarningExtensionsTests.cs @@ -36,7 +36,7 @@ public void Dispose() { } /// Tests that LogNullArgumentWarning LogsExpectedMessage. /// [TestMethod] - public void LogNullArgumentWarning_LogsExpectedMessage() { + public void LogNullArgumentWarning_Logs_Expected_Message() { var logger = new TestLogger(); logger.LogNullArgumentWarning("foo"); Assert.IsTrue(logger.Logs.Exists(l => l.Message.Contains("Argument foo is null.", StringComparison.Ordinal))); @@ -46,7 +46,7 @@ public void LogNullArgumentWarning_LogsExpectedMessage() { /// Tests that LogEmptyArgumentWarning LogsExpectedMessage. /// [TestMethod] - public void LogEmptyArgumentWarning_LogsExpectedMessage() { + public void LogEmptyArgumentWarning_Logs_Expected_Message() { var logger = new TestLogger(); logger.LogEmptyArgumentWarning("bar"); Assert.IsTrue(logger.Logs.Exists(l => l.Message.Contains("Argument bar is empty.", StringComparison.Ordinal))); @@ -56,7 +56,7 @@ public void LogEmptyArgumentWarning_LogsExpectedMessage() { /// Tests that LogInternalBufferOverflowWarning LogsExpectedMessage. /// [TestMethod] - public void LogInternalBufferOverflowWarning_LogsExpectedMessage() { + public void LogInternalBufferOverflowWarning_Logs_Expected_Message() { var logger = new TestLogger(); logger.LogInternalBufferOverflowWarning(1, 2, 3); Assert.IsTrue(logger.Logs.Exists(l => l.Message.Contains("Internal buffer has size of 2. At position 1 is required additional 3 space.", StringComparison.Ordinal))); @@ -66,7 +66,7 @@ public void LogInternalBufferOverflowWarning_LogsExpectedMessage() { /// Tests that LogCannotWriteValueToBufferWarning LogsExpectedMessage. /// [TestMethod] - public void LogCannotWriteValueToBufferWarning_LogsExpectedMessage() { + public void LogCannotWriteValueToBufferWarning_Logs_Expected_Message() { var logger = new TestLogger(); logger.LogCannotWriteValueToBufferWarning(4, 5); 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))); @@ -76,7 +76,7 @@ public void LogCannotWriteValueToBufferWarning_LogsExpectedMessage() { /// Tests that LogPolylineCannotBeShorterThanWarning LogsExpectedMessage. /// [TestMethod] - public void LogPolylineCannotBeShorterThanWarning_LogsExpectedMessage() { + public void LogPolylineCannotBeShorterThanWarning_Logs_Expected_Message() { var logger = new TestLogger(); logger.LogPolylineCannotBeShorterThanWarning(6, 7); Assert.IsTrue(logger.Logs.Exists(l => l.Message.Contains("Polyline is too short. Minimal length is 7. Actual length is 6.", StringComparison.Ordinal))); @@ -86,7 +86,7 @@ public void LogPolylineCannotBeShorterThanWarning_LogsExpectedMessage() { /// Tests that LogRequestedBufferSizeExceedsMaxBufferLengthWarning LogsExpectedMessage. /// [TestMethod] - public void LogRequestedBufferSizeExceedsMaxBufferLengthWarning_LogsExpectedMessage() { + public void LogRequestedBufferSizeExceedsMaxBufferLengthWarning_Logs_Expected_Message() { var logger = new TestLogger(); logger.LogRequestedBufferSizeExceedsMaxBufferLengthWarning(8, 9); Assert.IsTrue(logger.Logs.Exists(l => l.Message.Contains("Requested buffer size of 8 exceeds maximum allowed buffer length of 9.", StringComparison.Ordinal))); @@ -96,7 +96,7 @@ public void LogRequestedBufferSizeExceedsMaxBufferLengthWarning_LogsExpectedMess /// Tests that LogInvalidPolylineWarning LogsExpectedMessage. /// [TestMethod] - public void LogInvalidPolylineWarning_LogsExpectedMessage() { + public void LogInvalidPolylineWarning_Logs_Expected_Message() { var logger = new TestLogger(); logger.LogInvalidPolylineWarning(10); Assert.IsTrue(logger.Logs.Exists(l => l.Message.Contains("Polyline is invalid or malformed at position 10.", StringComparison.Ordinal))); @@ -107,7 +107,7 @@ public void LogInvalidPolylineWarning_LogsExpectedMessage() { /// [TestMethod] [SuppressMessage("Usage", "CA2201:Do not raise reserved exception types", Justification = "No need to be strict in tests.")] - public void LogInvalidPolylineFormatWarning_LogsExpectedMessage() { + public void LogInvalidPolylineFormatWarning_Logs_Expected_Message() { var logger = new TestLogger(); var ex = new Exception("fail"); logger.LogInvalidPolylineFormatWarning(ex); diff --git a/tests/PolylineAlgorithm.Tests/InvalidPolylineExceptionTests.cs b/tests/PolylineAlgorithm.Tests/InvalidPolylineExceptionTests.cs index 903d85ee..9c0ffcc3 100644 --- a/tests/PolylineAlgorithm.Tests/InvalidPolylineExceptionTests.cs +++ b/tests/PolylineAlgorithm.Tests/InvalidPolylineExceptionTests.cs @@ -16,7 +16,7 @@ public sealed class InvalidPolylineExceptionTests { /// Tests that the default constructor creates an instance with a null message. /// [TestMethod] - public void Constructor_Default_CreatesInstance() { + public void Constructor_With_Default_Creates_Instance() { // Act InvalidPolylineException ex = new(); @@ -29,7 +29,7 @@ public void Constructor_Default_CreatesInstance() { /// Tests that the message and inner exception constructor stores both values. /// [TestMethod] - public void Constructor_WithMessageAndInnerException_StoresBoth() { + public void Constructor_With_Message_And_Inner_Exception_Stores_Both() { // Arrange const string message = "polyline is malformed"; Exception inner = new InvalidOperationException("inner"); diff --git a/tests/PolylineAlgorithm.Tests/PolylineEncodingOptionsBuilderTests.cs b/tests/PolylineAlgorithm.Tests/PolylineEncodingOptionsBuilderTests.cs index 8a6d5324..26dafc74 100644 --- a/tests/PolylineAlgorithm.Tests/PolylineEncodingOptionsBuilderTests.cs +++ b/tests/PolylineAlgorithm.Tests/PolylineEncodingOptionsBuilderTests.cs @@ -19,7 +19,7 @@ public sealed class PolylineEncodingOptionsBuilderTests { /// Tests that Create returns a new builder instance. /// [TestMethod] - public void Create_ReturnsNewBuilder() { + public void Create_Returns_New_Builder() { // Act PolylineEncodingOptionsBuilder result = PolylineEncodingOptionsBuilder.Create(); @@ -31,7 +31,7 @@ public void Create_ReturnsNewBuilder() { /// Tests that Create returns different instances on multiple calls. /// [TestMethod] - public void Create_MultipleInvocations_ReturnsDifferentInstances() { + public void Create_With_Multiple_Invocations_Returns_Different_Instances() { // Act PolylineEncodingOptionsBuilder first = PolylineEncodingOptionsBuilder.Create(); PolylineEncodingOptionsBuilder second = PolylineEncodingOptionsBuilder.Create(); @@ -44,7 +44,7 @@ public void Create_MultipleInvocations_ReturnsDifferentInstances() { /// Tests that Build returns options with default values. /// [TestMethod] - public void Build_WithDefaults_ReturnsOptionsWithDefaultValues() { + public void Build_With_Defaults_Returns_Options_With_Default_Values() { // Arrange PolylineEncodingOptionsBuilder builder = PolylineEncodingOptionsBuilder.Create(); @@ -63,7 +63,7 @@ public void Build_WithDefaults_ReturnsOptionsWithDefaultValues() { /// Tests that Build returns options with configured precision. /// [TestMethod] - public void Build_WithCustomPrecision_ReturnsOptionsWithCustomPrecision() { + public void Build_With_Custom_Precision_Returns_Options_With_Custom_Precision() { // Arrange PolylineEncodingOptionsBuilder builder = PolylineEncodingOptionsBuilder.Create() .WithPrecision(7); @@ -79,7 +79,7 @@ public void Build_WithCustomPrecision_ReturnsOptionsWithCustomPrecision() { /// Tests that Build returns options with configured stack alloc limit. /// [TestMethod] - public void Build_WithCustomStackAllocLimit_ReturnsOptionsWithCustomStackAllocLimit() { + public void Build_With_Custom_Stack_Alloc_Limit_Returns_Options_With_Custom_Stack_Alloc_Limit() { // Arrange PolylineEncodingOptionsBuilder builder = PolylineEncodingOptionsBuilder.Create() .WithStackAllocLimit(1024); @@ -95,7 +95,7 @@ public void Build_WithCustomStackAllocLimit_ReturnsOptionsWithCustomStackAllocLi /// Tests that Build returns options with configured logger factory. /// [TestMethod] - public void Build_WithCustomLoggerFactory_ReturnsOptionsWithCustomLoggerFactory() { + public void Build_With_Custom_Logger_Factory_Returns_Options_With_Custom_Logger_Factory() { // Arrange ILoggerFactory loggerFactory = LoggerFactory.Create(_ => { }); PolylineEncodingOptionsBuilder builder = PolylineEncodingOptionsBuilder.Create() @@ -115,7 +115,7 @@ public void Build_WithCustomLoggerFactory_ReturnsOptionsWithCustomLoggerFactory( /// Tests that Build returns options with all custom values. /// [TestMethod] - public void Build_WithAllCustomValues_ReturnsOptionsWithAllCustomValues() { + public void Build_With_All_Custom_Values_Returns_Options_With_All_Custom_Values() { // Arrange ILoggerFactory loggerFactory = LoggerFactory.Create(_ => { }); PolylineEncodingOptionsBuilder builder = PolylineEncodingOptionsBuilder.Create() @@ -139,7 +139,7 @@ public void Build_WithAllCustomValues_ReturnsOptionsWithAllCustomValues() { /// Tests that Build can be called multiple times on the same builder. /// [TestMethod] - public void Build_MultipleInvocations_ReturnsDifferentInstancesWithSameValues() { + public void Build_With_Multiple_Invocations_Returns_Different_Instances_With_Same_Values() { // Arrange PolylineEncodingOptionsBuilder builder = PolylineEncodingOptionsBuilder.Create() .WithPrecision(6); @@ -158,7 +158,7 @@ public void Build_MultipleInvocations_ReturnsDifferentInstancesWithSameValues() /// Tests that WithStackAllocLimit sets the value and returns the builder. /// [TestMethod] - public void WithStackAllocLimit_ValidValue_SetsValueAndReturnsSelf() { + public void WithStackAllocLimit_With_Valid_Value_Sets_Value_And_Returns_Self() { // Arrange PolylineEncodingOptionsBuilder builder = PolylineEncodingOptionsBuilder.Create(); @@ -175,7 +175,7 @@ public void WithStackAllocLimit_ValidValue_SetsValueAndReturnsSelf() { /// Tests that WithStackAllocLimit accepts minimum value of 1. /// [TestMethod] - public void WithStackAllocLimit_MinimumValue_SetsValue() { + public void WithStackAllocLimit_With_Minimum_Value_Sets_Value() { // Arrange PolylineEncodingOptionsBuilder builder = PolylineEncodingOptionsBuilder.Create(); @@ -191,7 +191,7 @@ public void WithStackAllocLimit_MinimumValue_SetsValue() { /// Tests that WithStackAllocLimit throws ArgumentOutOfRangeException for zero. /// [TestMethod] - public void WithStackAllocLimit_Zero_ThrowsArgumentOutOfRangeException() { + public void WithStackAllocLimit_With_Zero_Throws_ArgumentOutOfRangeException() { // Arrange PolylineEncodingOptionsBuilder builder = PolylineEncodingOptionsBuilder.Create(); @@ -206,7 +206,7 @@ public void WithStackAllocLimit_Zero_ThrowsArgumentOutOfRangeException() { /// Tests that WithStackAllocLimit throws ArgumentOutOfRangeException for negative value. /// [TestMethod] - public void WithStackAllocLimit_NegativeValue_ThrowsArgumentOutOfRangeException() { + public void WithStackAllocLimit_With_Negative_Value_Throws_ArgumentOutOfRangeException() { // Arrange PolylineEncodingOptionsBuilder builder = PolylineEncodingOptionsBuilder.Create(); @@ -221,7 +221,7 @@ public void WithStackAllocLimit_NegativeValue_ThrowsArgumentOutOfRangeException( /// Tests that WithStackAllocLimit accepts large value. /// [TestMethod] - public void WithStackAllocLimit_LargeValue_SetsValue() { + public void WithStackAllocLimit_With_Large_Value_Sets_Value() { // Arrange PolylineEncodingOptionsBuilder builder = PolylineEncodingOptionsBuilder.Create(); @@ -238,7 +238,7 @@ public void WithStackAllocLimit_LargeValue_SetsValue() { /// Tests that WithStackAllocLimit can be called multiple times. /// [TestMethod] - public void WithStackAllocLimit_MultipleCalls_LastValueWins() { + public void WithStackAllocLimit_With_Multiple_Calls_Last_Value_Wins() { // Arrange PolylineEncodingOptionsBuilder builder = PolylineEncodingOptionsBuilder.Create(); @@ -256,7 +256,7 @@ public void WithStackAllocLimit_MultipleCalls_LastValueWins() { /// Tests that WithPrecision sets the value and returns the builder. /// [TestMethod] - public void WithPrecision_ValidValue_SetsValueAndReturnsSelf() { + public void WithPrecision_With_Valid_Value_Sets_Value_And_Returns_Self() { // Arrange PolylineEncodingOptionsBuilder builder = PolylineEncodingOptionsBuilder.Create(); @@ -274,7 +274,7 @@ public void WithPrecision_ValidValue_SetsValueAndReturnsSelf() { /// Tests that WithPrecision accepts zero value. /// [TestMethod] - public void WithPrecision_Zero_SetsValue() { + public void WithPrecision_With_Zero_Sets_Value() { // Arrange PolylineEncodingOptionsBuilder builder = PolylineEncodingOptionsBuilder.Create(); @@ -291,7 +291,7 @@ public void WithPrecision_Zero_SetsValue() { /// Tests that WithPrecision accepts maximum uint value. /// [TestMethod] - public void WithPrecision_MaxValue_SetsValue() { + public void WithPrecision_With_Max_Value_Sets_Value() { // Arrange PolylineEncodingOptionsBuilder builder = PolylineEncodingOptionsBuilder.Create(); @@ -308,7 +308,7 @@ public void WithPrecision_MaxValue_SetsValue() { /// Tests that WithPrecision can be called multiple times. /// [TestMethod] - public void WithPrecision_MultipleCalls_LastValueWins() { + public void WithPrecision_With_Multiple_Calls_Last_Value_Wins() { // Arrange PolylineEncodingOptionsBuilder builder = PolylineEncodingOptionsBuilder.Create(); @@ -327,7 +327,7 @@ public void WithPrecision_MultipleCalls_LastValueWins() { /// Tests that WithLoggerFactory sets the factory and returns the builder. /// [TestMethod] - public void WithLoggerFactory_ValidFactory_SetsValueAndReturnsSelf() { + public void WithLoggerFactory_With_Valid_Factory_Sets_Value_And_Returns_Self() { // Arrange PolylineEncodingOptionsBuilder builder = PolylineEncodingOptionsBuilder.Create(); ILoggerFactory loggerFactory = LoggerFactory.Create(_ => { }); @@ -349,7 +349,7 @@ public void WithLoggerFactory_ValidFactory_SetsValueAndReturnsSelf() { /// Tests that WithLoggerFactory with null uses NullLoggerFactory. /// [TestMethod] - public void WithLoggerFactory_Null_UsesNullLoggerFactory() { + public void WithLoggerFactory_With_Null_Uses_Null_LoggerFactory() { // Arrange PolylineEncodingOptionsBuilder builder = PolylineEncodingOptionsBuilder.Create(); @@ -367,7 +367,7 @@ public void WithLoggerFactory_Null_UsesNullLoggerFactory() { /// Tests that WithLoggerFactory can replace a previously set factory. /// [TestMethod] - public void WithLoggerFactory_ReplacePreviousFactory_UpdatesValue() { + public void WithLoggerFactory_With_Replace_Previous_Factory_Updates_Value() { // Arrange using ILoggerFactory firstFactory = LoggerFactory.Create(_ => { }); using ILoggerFactory secondFactory = LoggerFactory.Create(_ => { }); @@ -387,7 +387,7 @@ public void WithLoggerFactory_ReplacePreviousFactory_UpdatesValue() { /// Tests that WithLoggerFactory can be set to null after setting a factory. /// [TestMethod] - public void WithLoggerFactory_NullAfterFactory_UsesNullLoggerFactory() { + public void WithLoggerFactory_With_Null_After_Factory_Uses_Null_LoggerFactory() { // Arrange using ILoggerFactory factory = LoggerFactory.Create(_ => { }); PolylineEncodingOptionsBuilder builder = PolylineEncodingOptionsBuilder.Create() @@ -405,7 +405,7 @@ public void WithLoggerFactory_NullAfterFactory_UsesNullLoggerFactory() { /// Tests that builder supports method chaining for all methods. /// [TestMethod] - public void MethodChaining_AllMethods_ReturnsBuilderForChaining() { + public void MethodChaining_With_All_Methods_Returns_Builder_For_Chaining() { // Arrange using ILoggerFactory loggerFactory = LoggerFactory.Create(_ => { }); diff --git a/tests/PolylineAlgorithm.Tests/PolylineEncodingTests.cs b/tests/PolylineAlgorithm.Tests/PolylineEncodingTests.cs index 08b8bd0f..d598e3c2 100644 --- a/tests/PolylineAlgorithm.Tests/PolylineEncodingTests.cs +++ b/tests/PolylineAlgorithm.Tests/PolylineEncodingTests.cs @@ -18,7 +18,7 @@ public sealed class PolylineEncodingTests { /// Tests that Normalize returns zero when value is zero. /// [TestMethod] - public void Normalize_ZeroValue_ReturnsZero() { + public void Normalize_With_Zero_Value_Returns_Zero() { // Act int result = PolylineEncoding.Normalize(0.0); @@ -67,7 +67,7 @@ public void Normalize_With_Value_And_Precision_Returns_Expected_Normalized_Value /// Tests that Denormalize returns zero when value is zero. /// [TestMethod] - public void Denormalize_ZeroValue_ReturnsZero() { + public void Denormalize_With_Zero_Value_Returns_Zero() { // Act double result = PolylineEncoding.Denormalize(0); @@ -103,7 +103,7 @@ public void Denormalize_With_Value_And_Precision_Returns_Expected_Denormalized_V /// Tests that TryReadValue returns false when position is at buffer length. /// [TestMethod] - public void TryReadValue_PositionAtBufferLength_ReturnsFalse() { + public void TryReadValue_With_Position_At_Buffer_Length_Returns_False() { // Arrange ReadOnlyMemory buffer = "_p~iF~ps|U".AsMemory(); int delta = 0; @@ -121,7 +121,7 @@ public void TryReadValue_PositionAtBufferLength_ReturnsFalse() { /// Tests that TryReadValue returns false when position exceeds buffer length. /// [TestMethod] - public void TryReadValue_PositionExceedsBufferLength_ReturnsFalse() { + public void TryReadValue_With_Position_Exceeds_Buffer_Length_Returns_False() { // Arrange ReadOnlyMemory buffer = "_p~iF~ps|U".AsMemory(); int delta = 0; @@ -139,7 +139,7 @@ public void TryReadValue_PositionExceedsBufferLength_ReturnsFalse() { /// Tests that TryReadValue reads a positive single-character encoded value. /// [TestMethod] - public void TryReadValue_PositiveSingleChar_ReadsValueAndReturnsTrue() { + public void TryReadValue_With_Positive_Single_Char_Reads_Value_And_Returns_True() { // Arrange // Encode value 5: zigzag = 10 = 0x0A; char = 10 + 63 = 73 = 'I' ReadOnlyMemory buffer = "I".AsMemory(); // Single char encoding of value 5 @@ -159,7 +159,7 @@ public void TryReadValue_PositiveSingleChar_ReadsValueAndReturnsTrue() { /// Tests that TryReadValue reads a positive multi-character encoded value. /// [TestMethod] - public void TryReadValue_PositiveMultiChar_ReadsValueAndReturnsTrue() { + public void TryReadValue_With_Positive_Multi_Char_Reads_Value_And_Returns_True() { // Arrange // _p~iF encodes latitude 38.5 (normalized = 3850000, zigzag = 7700000) ReadOnlyMemory buffer = "_p~iF".AsMemory(); @@ -179,7 +179,7 @@ public void TryReadValue_PositiveMultiChar_ReadsValueAndReturnsTrue() { /// Tests that TryReadValue reads a negative encoded value. /// [TestMethod] - public void TryReadValue_NegativeValue_ReadsValueAndReturnsTrue() { + public void TryReadValue_With_Negative_Value_Reads_Value_And_Returns_True() { // Arrange // ~ps|U encodes longitude -120.2 (normalized = -12020000, zigzag encodes negative) ReadOnlyMemory buffer = "~ps|U".AsMemory(); @@ -199,7 +199,7 @@ public void TryReadValue_NegativeValue_ReadsValueAndReturnsTrue() { /// Tests that TryReadValue accumulates into existing delta. /// [TestMethod] - public void TryReadValue_WithExistingDelta_AccumulatesDelta() { + public void TryReadValue_With_Existing_Delta_Accumulates_Delta() { // Arrange ReadOnlyMemory buffer = "I".AsMemory(); // encodes 5 int delta = 10; // existing delta @@ -217,7 +217,7 @@ public void TryReadValue_WithExistingDelta_AccumulatesDelta() { /// Tests that TryReadValue reads multiple values sequentially from the buffer. /// [TestMethod] - public void TryReadValue_MultipleValues_ReadsSequentially() { + public void TryReadValue_With_Multiple_Values_Reads_Sequentially() { // Arrange - "_p~iF~ps|U" encodes lat 38.5 then delta lon -120.2 ReadOnlyMemory buffer = "_p~iF~ps|U".AsMemory(); int delta = 0; @@ -241,7 +241,7 @@ public void TryReadValue_MultipleValues_ReadsSequentially() { /// Tests that TryReadValue returns false when buffer ends mid-value. /// [TestMethod] - public void TryReadValue_BufferEndsMidValue_ReturnsFalse() { + public void TryReadValue_With_Buffer_Ends_Mid_Value_Returns_False() { // Arrange - truncate a multi-char encoding ReadOnlyMemory buffer = "_p~".AsMemory(); // incomplete multi-char encoding int delta = 0; @@ -258,7 +258,7 @@ public void TryReadValue_BufferEndsMidValue_ReturnsFalse() { /// Tests that TryReadValue correctly reads from a non-zero starting position. /// [TestMethod] - public void TryReadValue_StartingFromMiddle_ReadsCorrectly() { + public void TryReadValue_Starting_From_Middle_Reads_Correctly() { // Arrange - "_p~iF~ps|U": start at position 5 to read the longitude value ReadOnlyMemory buffer = "_p~iF~ps|U".AsMemory(); int delta = 0; @@ -281,7 +281,7 @@ public void TryReadValue_StartingFromMiddle_ReadsCorrectly() { /// Tests that TryWriteValue returns false when the buffer is too small. /// [TestMethod] - public void TryWriteValue_BufferTooSmall_ReturnsFalse() { + public void TryWriteValue_With_Buffer_Too_Small_Returns_False() { // Arrange Span buffer = []; int position = 0; @@ -298,7 +298,7 @@ public void TryWriteValue_BufferTooSmall_ReturnsFalse() { /// Tests that TryWriteValue returns false when the remaining buffer is too small. /// [TestMethod] - public void TryWriteValue_RemainingBufferTooSmall_ReturnsFalse() { + public void TryWriteValue_With_Remaining_Buffer_Too_Small_Returns_False() { // Arrange - need 5 chars for 3850000, but only 3 remain Span buffer = new char[3]; int position = 0; @@ -315,7 +315,7 @@ public void TryWriteValue_RemainingBufferTooSmall_ReturnsFalse() { /// Tests that TryWriteValue correctly encodes zero. /// [TestMethod] - public void TryWriteValue_ZeroValue_WritesCorrectly() { + public void TryWriteValue_With_Zero_Value_Writes_Correctly() { // Arrange Span buffer = new char[10]; int position = 0; @@ -333,7 +333,7 @@ public void TryWriteValue_ZeroValue_WritesCorrectly() { /// Tests that TryWriteValue correctly encodes a positive value. /// [TestMethod] - public void TryWriteValue_PositiveValue_WritesCorrectly() { + public void TryWriteValue_With_Positive_Value_Writes_Correctly() { // Arrange Span buffer = new char[10]; int position = 0; @@ -351,7 +351,7 @@ public void TryWriteValue_PositiveValue_WritesCorrectly() { /// Tests that TryWriteValue correctly encodes a negative value. /// [TestMethod] - public void TryWriteValue_NegativeValue_WritesCorrectly() { + public void TryWriteValue_With_Negative_Value_Writes_Correctly() { // Arrange Span buffer = new char[10]; int position = 0; @@ -369,7 +369,7 @@ public void TryWriteValue_NegativeValue_WritesCorrectly() { /// Tests that TryWriteValue correctly encodes multiple values sequentially. /// [TestMethod] - public void TryWriteValue_MultipleValues_WritesSequentially() { + public void TryWriteValue_With_Multiple_Values_Writes_Sequentially() { // Arrange Span buffer = new char[20]; int position = 0; @@ -388,7 +388,7 @@ public void TryWriteValue_MultipleValues_WritesSequentially() { /// Tests that TryWriteValue correctly encodes a small positive value. /// [TestMethod] - public void TryWriteValue_SmallPositiveValue_WritesCorrectly() { + public void TryWriteValue_With_Small_Positive_Value_Writes_Correctly() { // Arrange Span buffer = new char[10]; int position = 0; @@ -406,7 +406,7 @@ public void TryWriteValue_SmallPositiveValue_WritesCorrectly() { /// Tests that TryWriteValue correctly encodes a small negative value. /// [TestMethod] - public void TryWriteValue_SmallNegativeValue_WritesCorrectly() { + public void TryWriteValue_With_Small_Negative_Value_Writes_Correctly() { // Arrange Span buffer = new char[10]; int position = 0; @@ -424,7 +424,7 @@ public void TryWriteValue_SmallNegativeValue_WritesCorrectly() { /// Tests that TryWriteValue writes at the correct non-zero starting position. /// [TestMethod] - public void TryWriteValue_NonZeroStartPosition_WritesAtCorrectPosition() { + public void TryWriteValue_With_Non_Zero_Start_Position_Writes_At_Correct_Position() { // Arrange Span buffer = new char[20]; int position = 5; @@ -442,7 +442,7 @@ public void TryWriteValue_NonZeroStartPosition_WritesAtCorrectPosition() { /// Tests that TryWriteValue correctly encodes a large positive value. /// [TestMethod] - public void TryWriteValue_LargePositiveValue_WritesCorrectly() { + public void TryWriteValue_With_Large_Positive_Value_Writes_Correctly() { // Arrange Span buffer = new char[10]; int position = 0; @@ -461,7 +461,7 @@ public void TryWriteValue_LargePositiveValue_WritesCorrectly() { /// Tests that TryWriteValue correctly encodes a large negative value. /// [TestMethod] - public void TryWriteValue_LargeNegativeValue_WritesCorrectly() { + public void TryWriteValue_With_Large_Negative_Value_Writes_Correctly() { // Arrange Span buffer = new char[10]; int position = 0; @@ -503,7 +503,7 @@ public void GetRequiredBufferSize_Returns_Expected_Size(int delta, int expectedS /// Tests that GetRequiredBufferSize returns a valid size for the maximum positive integer. /// [TestMethod] - public void GetRequiredBufferSize_MaxInt_ReturnsCorrectSize() { + public void GetRequiredBufferSize_With_Max_Int_Returns_Correct_Size() { // Act int size = PolylineEncoding.GetRequiredBufferSize(int.MaxValue); @@ -516,7 +516,7 @@ public void GetRequiredBufferSize_MaxInt_ReturnsCorrectSize() { /// Tests that GetRequiredBufferSize returns a valid size for the minimum negative integer. /// [TestMethod] - public void GetRequiredBufferSize_MinInt_ReturnsCorrectSize() { + public void GetRequiredBufferSize_With_Min_Int_Returns_Correct_Size() { // Act int size = PolylineEncoding.GetRequiredBufferSize(int.MinValue); @@ -529,7 +529,7 @@ public void GetRequiredBufferSize_MinInt_ReturnsCorrectSize() { /// Tests that GetRequiredBufferSize is consistent with the actual bytes written by TryWriteValue. /// [TestMethod] - public void GetRequiredBufferSize_ConsistentWithTryWriteValue_MatchesActualSize() { + public void GetRequiredBufferSize_Consistent_With_TryWriteValue_Matches_Actual_Size() { // Arrange const int delta = 3778903; int expectedSize = PolylineEncoding.GetRequiredBufferSize(delta); @@ -548,7 +548,7 @@ public void GetRequiredBufferSize_ConsistentWithTryWriteValue_MatchesActualSize( /// Tests that an undersized buffer causes TryWriteValue to fail. /// [TestMethod] - public void GetRequiredBufferSize_UndersizedBuffer_CausesTryWriteValueToFail() { + public void GetRequiredBufferSize_With_Undersized_Buffer_Causes_TryWriteValue_To_Fail() { // Arrange const int delta = 3778903; int requiredSize = PolylineEncoding.GetRequiredBufferSize(delta); @@ -571,7 +571,7 @@ public void GetRequiredBufferSize_UndersizedBuffer_CausesTryWriteValueToFail() { /// Tests that ValidateFormat succeeds with a valid polyline. /// [TestMethod] - public void ValidateFormat_ValidPolyline_DoesNotThrow() { + public void ValidateFormat_With_Valid_Polyline_Does_Not_Throw() { // Act & Assert PolylineEncoding.ValidateFormat("_p~iF~ps|U_ulLnnqC_mqNvxq`@"); } @@ -580,7 +580,7 @@ public void ValidateFormat_ValidPolyline_DoesNotThrow() { /// Tests that ValidateFormat throws when polyline contains an invalid character. /// [TestMethod] - public void ValidateFormat_InvalidCharacter_ThrowsInvalidPolylineException() { + public void ValidateFormat_With_Invalid_Character_Throws_InvalidPolylineException() { // Act & Assert Assert.ThrowsExactly(() => PolylineEncoding.ValidateFormat("_p~iF!ps|U")); } @@ -589,7 +589,7 @@ public void ValidateFormat_InvalidCharacter_ThrowsInvalidPolylineException() { /// Tests that ValidateFormat throws when polyline has invalid block structure. /// [TestMethod] - public void ValidateFormat_InvalidBlockStructure_ThrowsInvalidPolylineException() { + public void ValidateFormat_With_Invalid_Block_Structure_Throws_InvalidPolylineException() { // Act & Assert Assert.ThrowsExactly(() => PolylineEncoding.ValidateFormat("________")); // all continuation chars, no terminator } @@ -598,7 +598,7 @@ public void ValidateFormat_InvalidBlockStructure_ThrowsInvalidPolylineException( /// Tests that ValidateFormat succeeds with a single terminator character. /// [TestMethod] - public void ValidateFormat_SingleTerminator_DoesNotThrow() { + public void ValidateFormat_With_Single_Terminator_Does_Not_Throw() { // Act & Assert PolylineEncoding.ValidateFormat("?"); } @@ -607,7 +607,7 @@ public void ValidateFormat_SingleTerminator_DoesNotThrow() { /// Tests that ValidateFormat throws when a block exceeds maximum length. /// [TestMethod] - public void ValidateFormat_BlockTooLong_ThrowsInvalidPolylineException() { + public void ValidateFormat_With_Block_Too_Long_Throws_InvalidPolylineException() { // Act & Assert Assert.ThrowsExactly(() => PolylineEncoding.ValidateFormat("________?")); // 8-char block (max is 7) } From 077339773549989a1d451b7f443c9b3c6d058480 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 3 Apr 2026 21:05:17 +0000 Subject: [PATCH 2/4] Apply all doc, workflow, config, and test rename changes Agent-Logs-Url: https://github.com/petesramek/polyline-algorithm-csharp/sessions/c16ebaf8-d9b8-4f8d-9942-7e24f006d5c2 Co-authored-by: petesramek <2333452+petesramek@users.noreply.github.com> --- .github/workflows/publish-documentation.yml | 18 +++++++ .github/workflows/release.yml | 52 +++++++++++++++++++ CONTRIBUTING.md | 1 - .../PolylineAlgorithm.Benchmarks.csproj | 7 --- docs/benchmarks.md | 1 - docs/branch-strategy.md | 52 +++++++++++++------ docs/extensibility.md | 20 +------ docs/testing.md | 6 +-- 8 files changed, 111 insertions(+), 46 deletions(-) diff --git a/.github/workflows/publish-documentation.yml b/.github/workflows/publish-documentation.yml index 60e95c4b..ddaa2f04 100644 --- a/.github/workflows/publish-documentation.yml +++ b/.github/workflows/publish-documentation.yml @@ -2,6 +2,12 @@ on: workflow_dispatch: + push: + branches: + - 'release/**' + paths: + - 'src/**' + - 'api-reference/**' permissions: actions: read @@ -13,8 +19,20 @@ concurrency: cancel-in-progress: true jobs: + validate-branch: + name: 'Validate branch' + runs-on: ubuntu-latest + steps: + - name: 'Ensure documentation is published from a release branch' + if: ${{ !startsWith(github.ref_name, 'release/') }} + run: | + echo "Documentation should only be published from 'release/**' branches." + echo "Current branch: '${{ github.ref_name }}'" + exit 1 + workflow-variables: name: 'Workflow variables' + needs: [validate-branch] runs-on: ubuntu-latest outputs: diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index cfdc85a7..cde39549 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -13,6 +13,7 @@ permissions: pages: write id-token: write contents: write + administration: write concurrency: group: release-${{ github.head_ref || github.ref }} @@ -314,3 +315,54 @@ jobs: else echo "⏭️ Skipped merge to main: **${{ env.current-branch }}** is not the highest release branch." >> $GITHUB_STEP_SUMMARY fi + + create-support-branch: + name: 'Create support branch for ${{ github.ref_name }}' + needs: [workflow-variables, release, versioning] + if: ${{ needs.workflow-variables.outputs.is-release == 'true' }} + runs-on: ubuntu-latest + env: + current-version: ${{ needs.versioning.outputs.friendly-version }} + steps: + - name: 'Checkout ${{ github.head_ref || github.ref }}' + uses: actions/checkout@v6 + with: + fetch-depth: 0 + + - name: 'Resolve support branch name' + id: resolve-support-branch + run: | + major_minor=$(echo "${{ env.current-version }}" | grep -oP '^\d+\.\d+') + echo "support-branch=support/$major_minor" >> $GITHUB_OUTPUT + + - name: 'Check if support branch already exists' + id: check-support-branch + run: | + git fetch origin + if git ls-remote --exit-code --heads origin "${{ steps.resolve-support-branch.outputs.support-branch }}" > /dev/null 2>&1; then + echo "support-branch-exists=true" >> $GITHUB_OUTPUT + else + echo "support-branch-exists=false" >> $GITHUB_OUTPUT + fi + + - name: 'Create support branch' + if: ${{ steps.check-support-branch.outputs.support-branch-exists == 'false' }} + run: | + git config user.name "$(git log -n 1 --pretty=format:%an)" + git config user.email "$(git log -n 1 --pretty=format:%ae)" + git checkout -b "${{ steps.resolve-support-branch.outputs.support-branch }}" + git push --set-upstream origin "${{ steps.resolve-support-branch.outputs.support-branch }}" + + - name: 'Lock support branch' + if: ${{ steps.check-support-branch.outputs.support-branch-exists == 'false' }} + uses: './.github/actions/github/branch-protection/lock' + with: + branch: ${{ steps.resolve-support-branch.outputs.support-branch }} + + - name: 'Write support branch summary' + run: | + if [[ "${{ steps.check-support-branch.outputs.support-branch-exists }}" == "false" ]]; then + echo "✅ Created and locked support branch **${{ steps.resolve-support-branch.outputs.support-branch }}**." >> $GITHUB_STEP_SUMMARY + else + echo "⏭️ Support branch **${{ steps.resolve-support-branch.outputs.support-branch }}** already exists." >> $GITHUB_STEP_SUMMARY + fi diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 05a4a576..a2492d27 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -14,7 +14,6 @@ In-depth developer guides are in the [`/docs`](./docs/README.md) folder: - [Branch Strategy](./docs/branch-strategy.md) — branch lifecycle and environments - [Versioning](./docs/versioning.md) — branch naming and the version pipeline - [API Documentation](./docs/api-documentation.md) — DocFX and the API reference site -- [Extensibility](./docs/extensibility.md) — how to add new encoding algorithms ## Guidelines diff --git a/benchmarks/PolylineAlgorithm.Benchmarks/PolylineAlgorithm.Benchmarks.csproj b/benchmarks/PolylineAlgorithm.Benchmarks/PolylineAlgorithm.Benchmarks.csproj index 70260ba9..99b5011f 100644 --- a/benchmarks/PolylineAlgorithm.Benchmarks/PolylineAlgorithm.Benchmarks.csproj +++ b/benchmarks/PolylineAlgorithm.Benchmarks/PolylineAlgorithm.Benchmarks.csproj @@ -14,15 +14,8 @@ false - - - - - - - diff --git a/docs/benchmarks.md b/docs/benchmarks.md index 0f15e44d..208cc0e2 100644 --- a/docs/benchmarks.md +++ b/docs/benchmarks.md @@ -25,7 +25,6 @@ Benchmarks use [BenchmarkDotNet](https://benchmarkdotnet.org/). Key packages: | Package | Purpose | |---|---| | `BenchmarkDotNet` | Core benchmarking framework | -| `BenchmarkDotNet.Diagnostics.Windows` | Windows-specific diagnostics (ETW) | ## Writing a New Benchmark diff --git a/docs/branch-strategy.md b/docs/branch-strategy.md index aa640ee7..efbb8f1d 100644 --- a/docs/branch-strategy.md +++ b/docs/branch-strategy.md @@ -7,8 +7,10 @@ This document describes the branch model, the purpose of each branch type, and h | Pattern | Purpose | Protected | |---|---|---| | `main` | Latest stable source of truth | ✅ Yes | -| `develop/**` | Active feature development | ❌ No | -| `support/**` | Maintenance / backport development | ❌ No | +| `develop/X.Y` | Active feature development sink for version X.Y | ✅ Yes (PR only) | +| `support/X.Y` | Maintenance / backport development sink for version X.Y | ✅ Yes (PR only) | +| `feature/-` | Individual feature work, merged into `develop/X.Y` via PR | ❌ No | +| `bugfix/-` | Bug fix work, merged into `support/X.Y` via PR | ❌ No | | `preview/X.Y` | Pre-release stabilization | ✅ Yes (1 approval required) | | `release/X.Y` | Release stabilization | ✅ Yes (1 approval required) | @@ -16,23 +18,28 @@ This document describes the branch model, the purpose of each branch type, and h ``` 1. Feature work - └─ develop/my-feature (or support/my-fix for backports) + └─ feature/123-my-feature │ - │ push to src/ → [build.yml] runs: format, compile, test, pack, publish-dev + │ PR → develop/X.Y │ -2. Promote to preview - └─ promote-branch.yml (manual) → creates preview/X.Y + PR: develop → preview/X.Y +2. Bug fix work + └─ bugfix/124-my-fix + │ + │ PR → support/X.Y + │ +3. Promote to preview + └─ promote-branch.yml (manual) → creates preview/X.Y + PR: develop/X.Y → preview/X.Y │ │ PR open → [pull-request.yml]: compile, test, pack, benchmark (optional) │ PR merged → [release.yml]: compile, test, pack, publish-NuGet (pre-release), GitHub release, docs │ -3. Promote to release +4. Promote to release └─ promote-branch.yml (manual) → creates release/X.Y + PR: preview/X.Y → release/X.Y │ │ PR open → [pull-request.yml] - │ PR merged → [release.yml]: publish-NuGet (stable), GitHub release, docs + │ PR merged → [release.yml]: publish-NuGet (stable), GitHub release, docs, creates support/X.Y │ -4. Back-merge (optional) +5. Back-merge (optional) └─ Manual PR: release/X.Y → main ``` @@ -45,18 +52,32 @@ This document describes the branch model, the purpose of each branch type, and h - Updated by merging from `release/X.Y` after a stable release. - The `build.yml` workflow does **not** trigger on `main` pushes (branch-ignore pattern excludes `preview/**` and `release/**`, and `main` does not match `src/**` changes by default in the context of the ignore rules — check the workflow for current specifics). -### `develop/**` +### `develop/X.Y` -- Naming convention: `develop/` (e.g. `develop/async-decoder`, `develop/1.2`). +- Naming convention: `develop/.` (e.g. `develop/1.2`). +- Protected: all changes are merged via pull request from `feature/**` branches. - The `build.yml` CI pipeline runs on every push to `src/`. - When ready for stabilization, use `promote-branch.yml` to create a `preview/X.Y` branch and open a PR. -### `support/**` +### `support/X.Y` -- Used for backport and maintenance work against older versions. -- Same CI behavior as `develop/**`. +- Naming convention: `support/.` (e.g. `support/1.0`). +- Auto-created when the first stable release from `release/X.Y` is published. +- Protected: all changes are merged via pull request from `bugfix/**` branches. - Can be promoted to `preview/X.Y` for a patch release. +### `feature/-` + +- Short-lived branch for individual feature work (e.g. `feature/123-async-decoder`). +- Merged into the appropriate `develop/X.Y` via pull request. +- Not protected — deleted after merging. + +### `bugfix/-` + +- Short-lived branch for bug fixes (e.g. `bugfix/124-decode-overflow`). +- Merged into the appropriate `support/X.Y` via pull request. +- Not protected — deleted after merging. + ### `preview/X.Y` - Created automatically by `promote-branch.yml`. @@ -70,6 +91,7 @@ This document describes the branch model, the purpose of each branch type, and h - Created automatically by `promote-branch.yml` from `preview/X.Y`. - Locked immediately: requires at least one PR approval. - On merge, `release.yml` publishes a **stable** NuGet package and a GitHub release. +- After the first stable release, a corresponding `support/X.Y` branch is auto-created. ## Version in Branch Names @@ -84,4 +106,4 @@ The `X.Y` in `preview/X.Y` and `release/X.Y` drives the version pipeline. See [V ## Locking and Unlocking Branches -`preview/**` and `release/**` branches are locked via the [`github/branch-protection/lock`](./composite-actions.md#githubbranch-protectionlock) composite action when created. The [`github/branch-protection/unlock`](./composite-actions.md#githubbranch-protectionunlock) action temporarily removes protection when a workflow needs to push directly (e.g., `bump-version.yml`). Branches are always re-locked immediately after. +`preview/**` and `release/**` branches are locked via the [`github/branch-protection/lock`](./composite-actions.md#githubbranch-protectionlock) composite action when created. `develop/X.Y` and `support/X.Y` branches must be manually configured as protected in repository settings (PR required, no direct pushes). The [`github/branch-protection/unlock`](./composite-actions.md#githubbranch-protectionunlock) action temporarily removes protection when a workflow needs to push directly (e.g., `bump-version.yml`). Branches are always re-locked immediately after. diff --git a/docs/extensibility.md b/docs/extensibility.md index ff8349b4..6df0d90a 100644 --- a/docs/extensibility.md +++ b/docs/extensibility.md @@ -1,6 +1,6 @@ # Extensibility -This guide explains how to add new coordinate types, polyline representations, and encoding schemes to PolylineAlgorithm. +This guide explains how to use PolylineAlgorithm with your own coordinate types and polyline representations. ## Design Overview @@ -105,14 +105,6 @@ public sealed class TuplePolylineDecoder : AbstractPolylineDecoder` and/or `IPolylineDecoder` directly. -3. If the new algorithm shares coordinate-type logic with an existing encoder/decoder, consider extracting that logic into a shared helper in the `PolylineAlgorithm.Utility` project. - ## Encoding Options `PolylineEncodingOptions` controls shared behavior. Configure it via `PolylineEncodingOptionsBuilder`: @@ -134,13 +126,3 @@ var decoder = new TuplePolylineDecoder(options); ## Extension Methods The library provides extension methods for `IPolylineEncoder` and `IPolylineDecoder` to support common collection types (`IEnumerable`, arrays, `ReadOnlyMemory`). These are in `PolylineAlgorithm.Extensions`. Your custom implementations automatically benefit from these extension methods as long as you implement the interfaces. - -## Checklist for a New Encoding Scheme - -- [ ] Create the encoder class in a new file (one class per file). -- [ ] Create the decoder class in a new file. -- [ ] Add XML doc comments to all public members. -- [ ] Add unit tests in `tests/PolylineAlgorithm.Tests/` following the [testing conventions](./testing.md). -- [ ] Add benchmarks in `benchmarks/PolylineAlgorithm.Benchmarks/` following the [benchmarking guide](./benchmarks.md). -- [ ] Update `PublicAPI.Unshipped.txt` with any new public API surface. -- [ ] Add usage samples in `samples/` if the new type is intended for end users. diff --git a/docs/testing.md b/docs/testing.md index 1f9ad54c..5b74868a 100644 --- a/docs/testing.md +++ b/docs/testing.md @@ -39,13 +39,13 @@ Key NuGet packages: ## Naming Conventions -Follow the existing pattern: `{Subject}_{Scenario}_{ExpectedResult}`. +Follow the pattern: `{Subject}_{With_Context}_{Expected_Result}` — every word separated by an underscore. Examples: ``` Decode_With_Null_Polyline_Throws_ArgumentNullException -Normalize_ZeroValue_ReturnsZero +Normalize_With_Zero_Value_Returns_Zero Normalize_With_Value_And_Precision_Returns_Expected_Normalized_Value ``` @@ -75,7 +75,7 @@ public sealed class MyClassTests { /// Tests that returns the expected result. /// [TestMethod] - public void MyMethod_WithValidInput_ReturnsExpected() { + public void MyMethod_With_Valid_Input_Returns_Expected() { // Arrange var sut = new MyClass(); From 2264ed401132d159e1f0856b567ef6787684b094 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 3 Apr 2026 21:07:32 +0000 Subject: [PATCH 3/4] Clarify support branch creation is first-time only in branch-strategy.md Agent-Logs-Url: https://github.com/petesramek/polyline-algorithm-csharp/sessions/c16ebaf8-d9b8-4f8d-9942-7e24f006d5c2 Co-authored-by: petesramek <2333452+petesramek@users.noreply.github.com> --- docs/branch-strategy.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/branch-strategy.md b/docs/branch-strategy.md index efbb8f1d..a3d07517 100644 --- a/docs/branch-strategy.md +++ b/docs/branch-strategy.md @@ -37,7 +37,7 @@ This document describes the branch model, the purpose of each branch type, and h └─ promote-branch.yml (manual) → creates release/X.Y + PR: preview/X.Y → release/X.Y │ │ PR open → [pull-request.yml] - │ PR merged → [release.yml]: publish-NuGet (stable), GitHub release, docs, creates support/X.Y + │ PR merged → [release.yml]: publish-NuGet (stable), GitHub release, docs, creates support/X.Y (first time only) │ 5. Back-merge (optional) └─ Manual PR: release/X.Y → main From 9b6e85b8f0f3aea73538d9ff4b8568fa9a43b814 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 3 Apr 2026 21:13:45 +0000 Subject: [PATCH 4/4] docs: make back-merge to main mandatory in branch-strategy.md Agent-Logs-Url: https://github.com/petesramek/polyline-algorithm-csharp/sessions/348e56c2-89f8-49f4-9cdc-cac961b71936 Co-authored-by: petesramek <2333452+petesramek@users.noreply.github.com> --- docs/branch-strategy.md | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/docs/branch-strategy.md b/docs/branch-strategy.md index a3d07517..fb13f779 100644 --- a/docs/branch-strategy.md +++ b/docs/branch-strategy.md @@ -39,17 +39,20 @@ This document describes the branch model, the purpose of each branch type, and h │ PR open → [pull-request.yml] │ PR merged → [release.yml]: publish-NuGet (stable), GitHub release, docs, creates support/X.Y (first time only) │ -5. Back-merge (optional) - └─ Manual PR: release/X.Y → main +5. Back-merge to main (automatic, highest version only) + └─ [release.yml] creates PR: release/X.Y → main (only when X.Y is the highest release branch) + │ + │ PR merged → main is updated to the latest stable source ``` ## Rules Per Branch Type ### `main` -- Represents the current stable release. +- Represents the latest stable release — always in sync with the highest released version. - Direct pushes are not allowed (protected). -- Updated by merging from `release/X.Y` after a stable release. +- Updated automatically via a PR created by `release.yml` whenever the highest `release/X.Y` branch publishes a stable release. +- Serves as the baseline for version bumps: new development versions are derived from the state of `main` at the point the previous release left off. - The `build.yml` workflow does **not** trigger on `main` pushes (branch-ignore pattern excludes `preview/**` and `release/**`, and `main` does not match `src/**` changes by default in the context of the ignore rules — check the workflow for current specifics). ### `develop/X.Y` @@ -92,6 +95,7 @@ This document describes the branch model, the purpose of each branch type, and h - Locked immediately: requires at least one PR approval. - On merge, `release.yml` publishes a **stable** NuGet package and a GitHub release. - After the first stable release, a corresponding `support/X.Y` branch is auto-created. +- When `X.Y` is the highest release branch, `release.yml` automatically opens a PR to merge back into `main`, keeping `main` in sync with the latest stable state. ## Version in Branch Names