Quantcast
Channel: ASP.NET Core
Viewing all articles
Browse latest Browse all 9386

Error creating controller in unit test

$
0
0

Hi

I'm trying to write unit tests for a controller and I'm getting the error "Internal Error in the expression evaluator" while I'm debugging the test and when I'm creating the controller

The error appear when I'm running the following line

var controller = new HomeController();

The project is empty, that means that I have created only the controller and nothing else and the purpose was just to experiment with tests, so apart from return a view, there is nothing else in the controller.
Both WebApplication and ClassLibrary (for the tests) are in .NET Core 1.0. I'm using nUnit 3.4.1 as a test runner (and "dotnet-test-nunit": "3.4.0-beta-2")

Both projects in the dependencies (project.json) have:

  "dependencies": {
    "Microsoft.NETCore.App": {
      "version": "1.0.0",
      "type": "platform"
    },
and for the frameworks:

  "frameworks": {
    "netcoreapp1.0": {
      "imports": [
        "dotnet5.6",
        "dnxcore50",
        "portable-net45+win8"
      ]
    }
  }
So, my question is, does anyone knows how correct the error and create a controller for test?

Thanks


Viewing all articles
Browse latest Browse all 9386

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>