-1

I have a class library project and have added to that another project which is a unit test project. In the class library project I have the following code:

public class NumberManipulator
{
    public int FindMax(int num1, int num2)
    {
        int result;
        if (num1 > num2)
            result = num1;
        else
            result = num2;
        return result;
    }
}

A simple bit of code to return the highest number out of two inputs. In my unit test project I am trying to call the FindMax method using the following:

NumberManipulator test = new NumberManipulator();

but the class is not recognised and giving the following message "The type or namespace name 'NumberManipulator' could not be found (are you missing a using directive or an assembly reference?)"

I have referenced the class project in the unit test project, not sure why I'm not able to call that class though.

Mohit Shrivastava
  • 12,996
  • 5
  • 31
  • 61
A H
  • 3
  • 2

1 Answers1

0

you will have to add

using nameSpace (where namespace would be namespace of your class library project.)

or other way would be:

<namespaceName>.NumberManipulator test = new <namespaceName>.NumberManipulator();
amit dayama
  • 3,090
  • 2
  • 13
  • 28