我想像这样在 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 预处理器符号(App.config 左右,会很棒),以便在 NUnit 和 VSTests 之间轻松切换?因为当我使用时#define NUNIT
,它仅适用于写入它的文件。