【问题标题】:Can Pex process the interface with the parameter of a class typePex可以处理带有类类型参数的接口吗
【发布时间】:2013-01-29 05:23:28
【问题描述】:

我已经安装了学术版的 pex 和角色。

我在 Visual Studio 2010 中编写了以下代码。但是 pex 只是给出了一个空指针作为输入。 pex 不支持类类型吗?请帮帮我。

测试接口是Test。

源代码:

public class ClassForPex
{

public int a;
public int b;
ClassForPex(int x, int y)
{
    a = x;
    b = y;
}
};

public static class StringExtensions
{

public static int Test(ClassForPex cjh)
{
    if (cjh.a > cjh.b)
        return cjh.a;
    else
    {
        return cjh.b;
    }
    }
}

【问题讨论】:

    标签: automated-tests pex


    【解决方案1】:

    您需要使用工厂将 ClassForPex 实例提供给测试。查看这篇文章,了解如何做到这一点。

    在 Pex 中使用工厂 - http://developers.de/blogs/damir_dobric/archive/2009/04/13/using-of-factory-in-pex.aspx

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-10-27
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-08-06
      相关资源
      最近更新 更多