将 NSubstitute 导入 Unity 项目

Den*_*iac 5 c# unit-testing unity-game-engine nsubstitute

我正在尝试在我的 Unity 项目(Unity 版本 2019.2.2f1)中使用 NSubstitute。无论如何导入它,当我尝试using NSubstitute说 NSubstitute 未定义时,我的 IDE(Visual Studio 和 JetBrains Rider)都会给出错误。

我尝试了 NSubstitute 软件包的许多选项和版本(4.2.1 和 2.0.3)。我还将包的 net35 文件夹中的 dll 文件导入到 Unity 项目中的 Plugins 文件夹中。我还尝试在 IDE 中使用 Nuget 安装相同版本的 NSubstitute。

小智 7

我在 Unity 项目中添加了 NSubstitute 4.2.1 (.NET Standard 2.0),但我需要再包含 3 个依赖项才能使其正常工作:

  1. 系统.线程.任务.扩展.4.5.3
  2. system.runtime.compilerservices.unsafe.4.6.0
  3. 城堡.核心.4.4.0