I usually set the attribute [ExcludeFromCodeCoverage]
to my Program class, as there are no unit tests for this class possible anyways (or don't make sense either), so it doesn't show up as "missing" in the coverage report:
[ExcludeFromCodeCoverage]
public static class Program
{
public static void Main(string[] args)
{
// do something awesome
}
}
But with top-level statements I don't know how to handle this. It seems not to be possible to set attributes, as I found here: https://mcmap.net/q/910716/-attributes-on-c-9-top-level-statements-file
So far, I stick to the classic Class declaration, but maybe they thought about something else, when it comes to unit test code coverage?
partial
keyword? – Melitamelitopol