ExcludeFromCodeCoverage for interface with default implementations
@fhnaseer ci sta già lavorando.
Dal 18/11/2024.
Valutazione
Questa issue non è ancora stata valutata.
Descrizione
Currently the ExcludeFromCodeCoverage attribute can only be placed on classes, constructors, methods, structs, properties, events and assemblies. However, now that C# 8.0 introduced interfaces with default implementations it could be useful to be able to be able to use the attribute on these as well.
As an example, in the visitor pattern I'm using an interface with default implementation so that visitors don't have to override every method:
public interface IVisitor
{
void Visit(FullName fullName) => throw new NotImplementedException();
void Visit(Address address) => throw new NotImplementedException();
void Visit(PhoneInfo phoneInfo) => throw new NotImplementedException();
}
Since testing these concrete methods (in my case) is not necessary, I would like to tag the interface with the ExcludeFromCodeCoverage attribute which is currently not possible. While I've got a few workarounds (adding the ExcludeFromCodeCoverage attribute to every single method declaration in the interface or using an abstract class and tagging the class itself) it might be worth letting the attribute be placed directly on interfaces.
- Lingua principale
- C#
- Stelle
- 125
- Fork
- 17
- Merge medio
- 1h 17m
- PR unite (30g)
- 2
Guida per i contributori
Nessuna guida per i contributori indicizzata per questo repository
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di microsoft/codecoverage
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 52/100
microsoft/codecoverage#246 · 6 commenti ·
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 55/100
microsoft/codecoverage#237 · 1 commento ·
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 35/100
microsoft/codecoverage#234 · 1 commento · 2 reazioni ·
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 52/100
microsoft/codecoverage#233 · 2 reazioni ·
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 28/100
microsoft/codecoverage#232 · 6 commenti ·
Tutte le issue di microsoft/codecoverage
Issue simili
-
effort:S P3 refactor
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
nightscout/nocturne#1532 ·
-
core dependencies
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 80/100
-
documentation
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
-
C#/.NET Roslyn LSP Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
-
Suspicious code fragments Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
DotNetNext/SqlSugar#1458 ·