snapshooter icon indicating copy to clipboard operation
snapshooter copied to clipboard

Enhance snapshot naming and improve formatting utilities

Open einsteine89 opened this issue 6 months ago • 1 comments

This pull request introduces improvements to how numeric values are formatted for error messages and snapshot names, ensuring consistent, culture-invariant string representations. It also refactors some helper methods for clarity and static usage, and updates related test helpers.

Numeric value formatting improvements

  • Updated GetAcceptFieldValueString in AcceptMatchOperator.cs to format decimal, double, and float values using CultureInfo.InvariantCulture, ensuring consistent string output regardless of system locale.
  • Added similar formatting logic to the FormatInvariant helper in both AcceptAssert.cs test files, used for error message comparisons in tests. [1] [2]

Method refactoring and static usage

  • Changed CreateAcceptExceptionMessage and GetAcceptFieldValueString in AcceptMatchOperator.cs to be static methods, clarifying their usage and improving code readability. [1] [2]
  • Added using System.Globalization where necessary to support invariant formatting. [1] [2] [3]

Snapshot name generation

  • Refactored GetMethodSnapshotName in MSTestSnapshotFullNameReader.cs to use SnapshotNameExtension.Create(...).ToParamsString() for generating parameter strings, likely improving consistency and maintainability of snapshot names.

einsteine89 avatar Sep 05 '25 13:09 einsteine89

CLA assistant check
All committers have signed the CLA.

swisslife-bot avatar Sep 05 '25 13:09 swisslife-bot