2

We're using t4mvc in our project which requires min 85% coverage

since adding in t4mvc our coverage has bombed! I don't see the point in testing generated code - is there a way to ommit this stuff from our coverage?

we're using xunit fwiw

  • Could you modify the templates to include the DebuggerNonUserCode attribute? similar/duplicate question: http://stackoverflow.com/questions/3337887/how-to-ignore-generated-code-from-code-coverage-data – G_P Mar 07 '12 at 17:13

1 Answers1

3

exactly as I was going to say G_P re your comment. the way to approach this is to add the DebuggerNonUserCode attribute, either at class level or at method level.

[DebuggerNonUserCode]
public partial class MyClass
{
    [DebuggerNonUserCode]
    public string SomeMethod
    {

    }

    public bool Anothermethod
    {

    }
}

see also:

should get you started...

jim tollan
  • 22,305
  • 4
  • 49
  • 63