i have created 2 Class library projects in one solution , named Fundamentls
and Fundamentals.test
inside Fundamentls i have class Greeter
namespace Fundamentals
{
public class Greeter
{
public string SayHello()
{
return "Hello" ;
}
}
}
now when in Fundamentals.test
i try to do this
using Fundamentals;
namespace Fundamentals.Test
{
[TestFixture]
public class GreeterTest
{
[Test]
public void SayHelloReturnsHello()
{
Greeter g = new Greeter();
}
}
}
now this is what i get
i have build the project after adding namespace but still does not work ,
Adding a using directive is not enough, first you need to add a reference to your assembly from your test project.Then include the namespace (optional) or use the fully-qualified name of the type.
You can refer to this documentation if you don't know how to add a reference to a different assembly from your project:
It looks like the Fundamentals.Test
project needs to refer to the Fundamentals
project.
Just right click on the References
node of the Fundamentals.Test
project and select Add Reference
from the right click menu.
If they are two different project then you will have to include the dll
in other project. have you done that?
I mean have you, added the reference of the fundamentals
project to fundamentals.test
by clicking on reference
folder and then click add reference
. You can directly select the dll from projects
tab.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.