Visual Studio 2015 IntelliTest:所选类型不可见且无法探索

Visual Studio 2015 IntelliTest: The selected type is not visible and cannot be explored

我有以下代码:

class Program
{
    static void Main(string[] args)
    {
        var area = AreaofSquare(5.0);
    }

    static double AreaofSquare(double side)
    {
        double area;
        area = Math.Pow(side, 2);
        return area;
    }
}

当我右键单击 AreaofSquare 方法和 select 运行 IntelliTest 时,我收到此错误消息:

The selected type is not visible and cannot be explored

为什么会出现这个错误?

IntelliTest 仅适用于 public 方法。将访问修饰符更改为 public 即可。

using System;

public class Program
{
    static void Main(string[] args)
    {
        var area = AreaofSquare(5.0);
    }

    public static double AreaofSquare(double side)
    {
        double area;
        area = Math.Pow(side, 2);
        return area;
    }
}

从 Visual Studio 2015 RTM 版本开始,我们添加了一个 "Create IntelliTest" 命令。此命令也可以是 运行 非 public 成员,并发出参数化单元测试和必要的 InternalsVisibleTo 属性。您随后可以在此参数化单元测试或其关联的被测代码上调用 "Run IntelliTest" 命令并探索它。请参阅此处:http://blogs.msdn.com/b/visualstudioalm/archive/2015/07/25/unit-test-generators-extensibility-hats-off-to-our-community.aspx?wa=wsignin1.0,了解上下文。