-
Notifications
You must be signed in to change notification settings - Fork 34
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
Replace UpdateStringFormatToFormattableString with String.Format #720
Comments
@Bartleby2718 The difference between an For completeness your tests are valid and in case a NUnit test actually uses an So yes we would need to convert: object[] args = new[] { ""first"", ""second"" };
ClassicAssert.AreEqual(args: args, actual: ""actual"", message: ""{0}, {1}"", expected: ""expected""); into:
Note the addition of |
Good to know that |
This issue is not just limited to 'named:' arguments, the current code will fail if the parameters for the format string are in an array. [TestCase(3.0, 4)]
public void Test(object actual, object expected)
{
object[] args = { expected, actual };
Assert.AreEqual(expected, actual, "Expected: {0} Got: {1}", args);
} The Assert.AreEqual(expected, actual, "Expected: {0} Got: {1}", args); But should be converted into: Assert.That(actual, Is.EqualTo(expected), () => string.Format("Expected: {0} Got: {1}", args)); |
Similar the following fails: ClassicAssert.AreEqual(expected, actual, GetLocalizedFormatSpecification(), expected, actual); |
I have implemented this on top of #716 and will rebase when that is merged. |
Consider the following (mostly similar) tests:
Some of these fail, even after #716. In order to fix
InStandardOrder3
, in particular, I believe we should replaceGetInterpolatedMessageArgumentOrDefault
withString.Format
:I think this will be come truly startable once dotnet/roslyn#68469 is done and released.
The text was updated successfully, but these errors were encountered: