您可以从TestContext.TestName属性获得此信息。{ public class UnitTest1 public TestContextTestContext { get; setvoid SetupTests(TestContexttestContext) _testContext = testContext;
}=
我正在使用的代码 public class ValidatePDF public NUnit.Framework.TestContextTestContext { get; set; } public void Init() string t = TestContext.TestDirectory;}
TestContext始终为空。Studio2017和NUni
我有一个visual studio 2008单元测试,我得到了以下运行时错误:
Unable to set TestContext property for the class JMPS.PlannerSuite.DataServices.MyUnitTestMicrosoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestAdapterContext' cannot be converted to type 'Microsoft.VisualStudio.TestTools.UnitTesting.T
在其中使用testContext参数添加您的属性。{ * Any user defined testContext.Properties
* added here will be erased实际上,每次调用每个测试方法之前,TestContext都会被覆盖,并使用最初的官方方法。如果只有当用户有测试初始化方法时才覆盖它,则在那里所做的更改将传递给测试。("this is preserved
我需要在TestContext.Properties之前访问TestMethod,这样测试才能接收到要测试的正确环境。
<?但是,当我试图在一个TestContext中实例化TestClass时,如下所示: public class GenerarBoletinDeClase : TestBase{
private s