access method 'System.Web.Http.HttpConfiguration.DefaultFormatters()' failed

后端 未结 3 635
生来不讨喜
生来不讨喜 2020-12-18 19:02

I have problem with unit testing my WEB API controller, I\'m using moq to mock up my repository, do the setup and response for it. Then initiate the controller with mocked r

3条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-18 19:32

    Make sure that the following Nuget packaged libraries are at the same version:

    Microsoft.AspNet.WebApi
    Microsoft.AspNet.WebApi.Client
    Microsoft.AspNet.WebApi.Core
    Microsoft.AspNet.WebApi.WebHost
    

提交回复
热议问题