Open tisonv opened 4 months ago
Thanks for reporting and providing a repro. I see if I can get the discussion in #1576 started. I think we then would have less issues with records.
Our SonarQube would not allow my PR since coverage was subpar. I was just refactoring dtos . I had to [ExcludeFromCodeCoverage] for the time being
Could you elaborate a bit on how to reproduce this? With my setup I can get coverage for those records.
Hello !
Latest SonarQube expects all the lines to be covered https://community.sonarsource.com/t/sonarqube-not-showing-coverage-for-inherited-record/107476 I'm not sure whether they should be marked as covered or not
I have an internal record:
internal record Foo
{
public string Bar() => "baz";
}
And an associated test project with a test:
[TestFixture]
internal class FooTests
{
[Test]
public void FooBarShouldReturnBaz()
{
var foo = new Foo();
Assert.That(foo.Bar(), Is.EqualTo("baz"));
}
}
After running the test, the method call shows that it was covered, but the record itself does not:
If I modify the record declaration to include the redundant primary constructor parentheses:
internal record Foo()
{
public string Bar() => "baz";
}
and repeat the test, this time I get green all around:
Describe the bug With .Net 8, records show no coverage Tested with the nightly build too I read #1561 #1607 #1576
To Reproduce
Expected behavior
FolderInfoDto
,CreateFolderDto
,DeleteFolderDto
,BasicFolderDto
are marked as covered.Actual behavior They are marked as not covered.
Configuration (please complete the following information): Please provide more information on your .NET configuration:
Additional context
<TargetFramework>net8.0</TargetFramework>
or<TargetFramework>net8.0-windows10.0.17763.0</TargetFramework>
abstract
orsealed
makes no differencetest.runsettings: