문제

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?
  }

  ...
}
도움이 되었습니까?

해결책

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top