When applying the "Use Assert.EnterMultipleScope method" code fix for "NUnit2056: Consider using Assert.EnterMultipleScope statement instead of Assert.Multiple/Assert.MultipleAsync" it's erasing comments and empty lines above it.
NUnit.Analyzers version: 4.9.2
Example:
[Test]
public void Test1()
{
// Arrange
const int expected = 4;
// Act
int? actual = 2 + 2;
// Assert
Assert.Multiple(() => {
Assert.That(actual, Is.Not.Null);
Assert.That(actual, Is.EqualTo(expected));
});
}
Actual result:
[Test]
public void Test1()
{
// Arrange
const int expected = 4;
// Act
int? actual = 2 + 2;
using (Assert.EnterMultipleScope())
{
Assert.That(actual, Is.Not.Null);
Assert.That(actual, Is.EqualTo(expected));
}
}
Expected result:
[Test]
public void Test1()
{
// Arrange
const int expected = 4;
// Act
int? actual = 2 + 2;
// Assert
using (Assert.EnterMultipleScope())
{
Assert.That(actual, Is.Not.Null);
Assert.That(actual, Is.EqualTo(expected));
}
}
When applying the "Use Assert.EnterMultipleScope method" code fix for "NUnit2056: Consider using Assert.EnterMultipleScope statement instead of Assert.Multiple/Assert.MultipleAsync" it's erasing comments and empty lines above it.
NUnit.Analyzers version: 4.9.2
Example:
Actual result:
Expected result: