Frage

What should go in the "Function mask" field in dotCover's "Edit Coverage Filter" dialog? I've tried "Foo" and "Foo*" with no effect.

example:

public class Foo
{
  public Foo(int x, int y)
  {
     // how can I exclude this code from the code coverage calculation?
  }

  ...
}
War es hilfreich?

Lösung

First of all, it's worth mentioning that dotCover analyses complied assemblies, not the source code, to generate its coverage reports. Any C# constructor (irrespective of its name in C#) is compiled into a method named .ctor (or .cctor if the constructor is static). That's why dotCover will never see a method called Foo(int, int) in your example.

If you want to filter out the constructors of the Foo class, you need to type the following in "Edit Coverage Filter" dialog:

  • Module Mask: YourNamespace
  • Class Mask: YourNamespace.Foo
  • Function Mask: .ctor

Hope this helps.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top