我们可以要求PEX不要对用户定义的库的方法进行约束吗? [英] Can we ask PEX not to make constraints for the methods of a user-defined library?

查看:74
本文介绍了我们可以要求PEX不要对用户定义的库的方法进行约束吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用库"ClassLibrary1"而且它的方法是复杂且昂贵的探索.

I am using a library "ClassLibrary1" and the methods it has are complex and expensive to explore.

有没有一种方法可以限制PEX探索这些方法?

Is there a way to limit PEX to explore these methods?

作为示例,请考虑以下代码:

As an example consider the following code:

使用ClassLibrary1;

命名空间CodeDigging
{
   公共静态类CD
    {
     
      公共静态无效测试(int x)
       {
           double y = Class1.someComplexMethod(x);
          如果(y == 8)...
       }

using ClassLibrary1;

namespace CodeDigging
{
    public static class CD
    {
      
        public static void test(int x)
        {
            double y = Class1.someComplexMethod(x);
            if (y == 8) ...
        }

  }

}

 

我只希望Pex不要探索someComplexMethod(x),而只考虑返回的值.

I just want Pex not to explore someComplexMethod(x) and only consider the returned value.

推荐答案

您可以使用Pex Instrumentation限制对Pex的利用

PexInstrumentAssemblyAttribute   指定要检测装配体
PexInstrumentTypeAttribute          指定检测类型
PexAssemblyUnderTestAttribute    将测试项目绑定到项目

You can use Pex Instrumentation to limit Pex Exploitation

PexInstrumentAssemblyAttribute    Specifies to instrument an assembly
PexInstrumentTypeAttribute           Specifies to instrument a type
PexAssemblyUnderTestAttribute      Binds a test project to a project

[assembly:PexAssemblyUnderTest("MyAssembly")]
[assembly:PexInstrumentAssembly("Lib")]
[assembly:PexInstrumentType(typeof(MyClass))]


这篇关于我们可以要求PEX不要对用户定义的库的方法进行约束吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆