Visual Studio 2015 IntelliTest: the selected type is not displayed and cannot be learned

I have the following code:

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;
    }
}

      

When I right click on the method AreaofSquare

and select Run IntelliTest, I get this error message:

The selected type is not displayed and cannot be learned

Why is this error?

+3


source to share


2 answers


IntelliTest only works with public methods. Change the access modifier to public and it works.



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;
    }
}

      

+4


source


Starting with the RTM version of Visual Studio 2015, we added the Create IntelliTest command. This command can be run on non-public elements as well, and will also emit parameterized unit test and required InternalsVisibleTo attributes. You can then invoke the Run IntelliTest command in that parameterized unit test or related code test and examine it. See here http://blogs.msdn.com/b/visualstudioalm/archive/2015/07/25/unit-test-generators-extensibility-hats-off-to-our-community.aspx?wa=wsignin1.0 , for context.



0


source







All Articles