I have created a connectionstring in mvc3 application and it is working fine in mvc views and controllers and I am able to fetch data. Now I have called the repository/model functions in a Unit Test in Test project and I am getting error:
System.Data.EntityCommandExecutionException: An error occurred while executing the command definition. See the inner exception for details. ---> System.Data.SqlClient.SqlException: Invalid object name 'dbo.tblProduct'.
How can i fix it?
That has nothing to do particularly with MVC. As it seems, when testing, you use ConnectionString on database that does not have 'dbo.tblProduct' table/view. Check the connetion string and database. You may need to debug tests
Check your table may have different schema (other then dbo) change it to dbo using query below
look at this. How do I change db schema to dbo
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With