I have a class library in which I used entity framework
I added a unit test project to test the DAL
dll :
[TestMethod]
public void TestConnection()
{
try
{
ICrud<ajt_demande> dem = new Crud<ajt_demande>();
List<ajt_demande> lst = (List<ajt_demande>)dem.GetAll();
Console.WriteLine(lst.Count);
}
catch (Exception ex)
{
Console.WriteLine(ex.ToString());
throw new AssertFailedException();
}
}
I get an exception indicates that the connection string is not found !!!
I need to know :
The connection strings are taken from the executing assembly (in your case it's AjTransport.Test
). Therefore you need to define the connection strings there. There are some options:
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.