Skip to content

MSTEST0037 code fix messes up whitespace / new lines #7204

@LukasGelke

Description

@LukasGelke

Describe the bug

I've been tasked to upgrade multiple of our projects from MsTest 3.x to 4.x. In doing so, i upgrade Package Version in steps, ie: 3.9.* -> 3.10.* -> 3.11 [-> 4.* where applicable].
The new Analyzers/CodeFixes are not implemented with enough care. A "fix all in solution" results in widespread ugly code.

Steps To Reproduce

  1. include a version with Analyzer+Codefix for MSTEST0037
[TestClass]
public sealed class Test1
{
    [TestMethod]
    public void TestMethod1()
    {
        List<int> numbers = [1, 2, 3];
        Assert.IsTrue(numbers.Contains(2),
          "list has wrong count");
    }
}

Expected behavior

namespace TestProject1;

[TestClass]
public sealed class Test1
{
    [TestMethod]
    public void TestMethod1()
    {
        List<int> numbers = [1, 2, 3];
        Assert.Contains(2, numbers,
          "list has wrong count");
    }
}

Actual behavior

Image
[TestClass]
public sealed class Test1
{
    [TestMethod]
    public void TestMethod1()
    {
        List<int> numbers = [1, 2, 3];
        Assert.Contains(2,
numbers, "list has wrong count");
    }
}

Additional context

this bugfix should be backported to 3.x to ease migration

Metadata

Metadata

Assignees

Type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions