mardi 13 septembre 2016

ASP NET MVC 5 TestMethod Entity Exception

I have a MVC 5 project at my visual studio 2015. I have used the ADO Entity Data Model to create my domain models Data Base First and I have a custom Identity (I don't know if it matters anyway) and evething works fine until here. The problem is when I start to create my UnitTest Class. First I click with the right mouse button and choose create unit tests, so I did something like that

    [TestMethod()]
    public void PermissionsTest()
    {
        GroupController controller = new GroupController();
        var result = controller.Permissions("1") as ViewResult;
        Assert.AreEqual("Details", result.ViewName);
    }

I put my MVC project reference into my Test project too and I updated my app.config adding the connectionStrings that I am using at my MVC project. But I receive the Exception:

  Result Message:   
  Test method Controllers.Tests.GroupControllerTests.PermissionsTest threw exception: 
  System.Data.Entity.Core.MetadataException: Schema specified is not valid. Errors: 
  Models.Domain.Models.ssdl(2,2) : error 0152: No Entity Framework provider found for the ADO.NET provider with invariant name 'System.Data.SqlClient'. Make sure the provider is registered in the 'entityFramework' section of the application config file. See http://ift.tt/19X4Ntk for more information.

So anyone could help me?

Aucun commentaire:

Enregistrer un commentaire