Ninject在运行xunit时尝试绑定两次

时间:2019-04-03 13:35:35

标签: c# .net ninject xunit

我正在使用xUnit在我们的项目上的WebApi上运行一些测试,似乎每次运行测试时,它都在运行同一项目的Startup类。例如,范围内有6个测试,它将执行6次启动。到目前为止还算不错,但是Ninject给出了一个错误,因为它每次启动时都会尝试绑定它的dll,如下所示:

"Failed   Dell.Dss.IntegratedTest.WebApi.Rules.RulesControllerTests.DeleteRulePack_Returns_NotFound_When_Id_Is_Invalid
Error Message:
 System.NotSupportedException : Error loading module 'Dell.Dss.WebApi.Rules.NinjectBindingsRules' of type NinjectBindingsRules
Another module (of type NinjectBindingsRules) with the same name has already been loaded
Suggestions:
  1) Ensure that you have not accidentally loaded the same module twice.
  2) If you are using automatic module loading, ensure you have not manually loaded a module
     that may be found by the module loader"
    ```

0 个答案:

没有答案