3

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 AreaofSquare method and select Run IntelliTest, I get this error message:

The selected type is not visible and cannot be explored

Why this error?

Kevin Andrid
  • 1,963
  • 1
  • 15
  • 26
Null Reference
  • 11,260
  • 40
  • 107
  • 184

2 Answers2

4

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;
    }
}
greenhoorn
  • 1,601
  • 2
  • 15
  • 39
0

Starting with the Visual Studio 2015 RTM release, we have added a "Create IntelliTest" command. This command can be run on non-public members as well, and emits a parameterized unit test and the necessary InternalsVisibleTo attributes. You can subsequently invoke the "Run IntelliTest" command on this parameterized unit test or its associated code-under-test and explore it. Please 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.

pvlakshm
  • 1,365
  • 7
  • 7