Skip to content

MSTest: DataRow-snap file path varies by OS culture #221

@N-Olbert

Description

@N-Olbert

Describe the bug
Currently, the arguments of [DataRow] tests are transformed into string values using the actual OS culture. Therefore, the file paths may vary depending on the system locale.

To Reproduce

[TestClass]
public sealed class Test1
{
    [DataTestMethod]
    [DataRow(1.5)]
    public void TestMethod1(double value)
    {
        value.MatchSnapshot();
    }
}

Expected behavior
The snapshot file path should be identical across all systems.
Currently, on a German system it becomes something like: Test1.TestMethod1_1,5.snap
whereas on an English system it is: Test1.TestMethod1_1.5.snap

Suggested Solution
Use Invariant Culture when converting values to strings to ensure consistent file paths across different locales.
This is a breaking change, though.

Desktop (please complete the following information):

  • OS: Win 11
  • Version Snapshooter.MsTest V 1.01

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions