How Do You Configure Pex to Respect Code Contracts?

后端 未结 5 1144
忘了有多久
忘了有多久 2021-01-02 16:13

Given the following example code, how can I configure Pex to respect my Code Contracts?

    public static IEnumerable Administrators(this UserGro         


        
5条回答
  •  余生分开走
    2021-01-02 17:02

    I had the same problem. There are two things:

    1) Check that Run-time rewriting is enabled (as John suggests)

    2) Make sure that your test class is decorated with [PexClass(typeof(MyClass))]

    I have written the test manually so I have forgot that PexClass attribute and the contracts were treated as regular exceptions by Pex - so they were failing.

    Honza

提交回复
热议问题