Closed wgebczyk closed 7 months ago
Hello @wgebczyk, in your scenario constructor is invoked to create instance of SomeSettings
and constructor is not using setter.
To get setter covered you need to use syntax with
. Check: https://github.com/microsoft/codecoverage/issues/102#issuecomment-1959564840
If you don't want set_Name
to be in coverage report you can also exclude it using configuration.
You can also use attribute [ExcludeFromCodeCoverage]
on top of record to exclude it but this will also exclude constructor.
Thank you for your answer. After second though, you are right, this ctor wont use property, but directly set backing field.
Hello,
I've spotted inconsistent coverage report. It seems that code used by JsonSerializer "does not count as used".
Executed via
dotnet-coverage collect 'dotnet test' -f xml -o coverage.xml
reports:Expected: In this example deserialization will touch at least
set_Name
(indirectly Name property), hence this "should be covered".PS: This report is not about if test makes sense, if testing POCO makes sense, using dotnet-coverage makes sense etc.