Consider the following code. 0 is a compile-time constant and typeof(TestAnalyzer) is a runtime constant, but passing a runtime constant like typeof() as the actual is still likely an indicator of misuse. The analyzers don't currently identify cases like this but it might be helpful to extend them to catch it.
[Test]
public void Test1()
{
var result = new TestAnalyzer();
Assert.That(typeof(TestAnalyzer), Is.EqualTo(result.GetType()));
Assert.That(0, Is.EqualTo(result.RowVersion));
}
public class TestAnalyzer
{
public Guid Id { get; set; } = Guid.Empty;
public int RowVersion { get; set; } = 0;
}
Consider the following code.
0is a compile-time constant andtypeof(TestAnalyzer)is a runtime constant, but passing a runtime constant liketypeof()as theactualis still likely an indicator of misuse. The analyzers don't currently identify cases like this but it might be helpful to extend them to catch it.