Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MSTEST0025 (PreferAssertFailOverAlwaysFalseConditions) fixer doesn't preserve the message #4300

Closed
Youssef1313 opened this issue Dec 10, 2024 · 0 comments · Fixed by #4301
Closed

Comments

@Youssef1313
Copy link
Member

The bug is shown by this test already.

public async Task WhenAssertIsTrueIsPassedFalse_WithMessage_Diagnostic()
{
string code = """
using Microsoft.VisualStudio.TestTools.UnitTesting;
[TestClass]
public class MyTestClass
{
[TestMethod]
public void TestMethod()
{
[|Assert.IsTrue(false, "message")|];
}
}
""";
string fixedCode = """
using Microsoft.VisualStudio.TestTools.UnitTesting;
[TestClass]
public class MyTestClass
{
[TestMethod]
public void TestMethod()
{
Assert.Fail();
}
}
""";
await VerifyCS.VerifyCodeFixAsync(code, fixedCode);
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants