我想像这样在NUnit和VS测试之间切换:

#if !NUNIT
using Microsoft.VisualStudio.TestTools.UnitTesting;
#else
  using NUnit.Framework;
  using TestClass = NUnit.Framework.TestFixtureAttribute;
  using TestMethod = NUnit.Framework.TestAttribute;
  using TestInitialize = NUnit.Framework.SetUpAttribute;
  using TestCleanup = NUnit.Framework.TearDownAttribute;
  using TestContext = System.String;
  using DeploymentItem = NUnit.Framework.DescriptionAttribute;
#endif

我的问题是,如何在一个地方声明NUNIT preprocesor符号(App.config左右,会很棒),以便在NUnit和VSTest之间轻松切换?因为当我使用#define NUNIT时,它仅适用于写入文件的文件。

最佳答案

使用项目属性对话框。您可以在此处定义全局符号:

10-07 19:38
查看更多