snapshooter
snapshooter copied to clipboard
Enhance snapshot naming and improve formatting utilities
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
GetAcceptFieldValueStringinAcceptMatchOperator.csto formatdecimal,double, andfloatvalues usingCultureInfo.InvariantCulture, ensuring consistent string output regardless of system locale. - Added similar formatting logic to the
FormatInvarianthelper in bothAcceptAssert.cstest files, used for error message comparisons in tests. [1] [2]
Method refactoring and static usage
- Changed
CreateAcceptExceptionMessageandGetAcceptFieldValueStringinAcceptMatchOperator.csto be static methods, clarifying their usage and improving code readability. [1] [2] - Added
using System.Globalizationwhere necessary to support invariant formatting. [1] [2] [3]
Snapshot name generation
- Refactored
GetMethodSnapshotNameinMSTestSnapshotFullNameReader.csto useSnapshotNameExtension.Create(...).ToParamsString()for generating parameter strings, likely improving consistency and maintainability of snapshot names.