在 MBUnit 中,我可以使用 Factory 和多个 getter 来注释我的 Test 类,返回一个 oracle/sql/mysql 连接字符串,该字符串可以通过测试类中的每个测试方法获得。
如何使用 Visual Studio 2010 的单元测试项目做到这一点?
例如,我不允许从 TestContext 继承并将该对象传递给我的 ClassInit 方法吗?
[ClassInitialize()]
public static void MyClassInitialize(MyContextDerivedFromTextContext testContext)
{
}
我不想用这样的属性对我的 TestMethods 进行硬编码注释:
[DataSource("System.Data.SqlClient", "Data Source=.\\SQLEXPRESS;Initial Catalog=STM;Integrated Security=True;Pooling=False", "CustomerTable", DataAccessMethod.Sequential), TestMethod]
public void TestMethod1()
{
//
// TODO: Add test logic here
//
}
我要这个:
public void TestMethod1(String testconnectionStringOracleORMySQLORMSSQLetc...)
{
//
// TODO: Add test logic here
//
}