Exclude System.Diagnostics.Contracts When Using PartCover

574 Views Asked by At

I am trying out the .net Code Contracts fro .net 3.5 I have some unit test that I am running PartCover over to calculate the code coverage.

PartCover keeps including the System.Diagnostics.Contracts in my report. Here are the rules I am using to include MyProject and exclude everything else.

  <Rule>+[MyProject.DomainModel]*</Rule>
  <Rule>-[System]*</Rule>
  <Rule>-[System.Diagnostics]*</Rule>
  <Rule>-[System.Diagnostics.Contracts]*</Rule>

Any suggestions?

1

There are 1 best solutions below

0
On

PartCover's rule syntax is [assemblyname]namespace, the contracts come from the Microsoft.Contracts assembly and therefore the configuration has to look like this:

<Rule>+[MyProject.DomainModel]*</Rule>
<Rule>-[Microsoft.Contracts]*</Rule>

Read the PartCover Console Manual that is installed with PartCover for more details.