Search code examples
c#visual-studio-2015intellitest

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


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?


Solution

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