Describe the bug
The fixer for MSTEST0037 is not handling nullable args correctly.
Steps To Reproduce
[TestMethod]
public void TestMethod1()
{
int? count = 3;
Assert.AreEqual(count, new List<string>().Count);
}
Applying the fixer yields:
[TestMethod]
public void TestMethod1()
{
int? count = 3;
Assert.HasCount(count, new List<string>());
}
but this yields
CS1503 Argument 1: cannot convert from 'int?' to 'int'
The proper fix should be
[TestMethod]
public void TestMethod1()
{
int? count = 3;
Assert.IsTrue(count.HasValue); // or Assert.IsNotNull(count)
Assert.HasCount(count.Value, new List<string>());
}
Describe the bug
The fixer for MSTEST0037 is not handling nullable args correctly.
Steps To Reproduce
Applying the fixer yields:
but this yields
The proper fix should be