The following constructor parameters did not have matching fixture data

前端 未结 3 1900
感动是毒
感动是毒 2021-02-12 16:29

I\'m trying to test my controllers using xUnitbut getting the following error during execution of Customer Controller:

\"The following constr

3条回答
  •  长情又很酷
    2021-02-12 16:58

    This article shows how to get xunit working with .Net Core ASP.Net really well. It actually replaces the startup so that your controllers run in the same process, and you can test them as if they were local.

    https://docs.microsoft.com/en-us/aspnet/core/test/integration-tests

    It allows your standard .Net Dependency Injection to work as it normally does. Moreover it has the amazing benefit of not running as a server, and it fakes the whole startup process so that it runs in one single process and you can debug all the way through. This is also the way you should do it because Microsoft says so.

    There's more help to be gleaned from the forum at the bottom of the article.

提交回复
热议问题