When the Code Generation Engine scans the .NET assembly and finds a method with a TestMethod attribute, the engine scripts a call to the method in the current transaction. The current transaction is the transaction method that was declared before the test method. As a result, declaring a test method without a transaction method results in an error. Declaration means that the transaction method has been declared previously in the code.
| C# Code | BDL Script |
|---|---|
[Transaction(Etranstype.TRANSTYPE_MAIN)]
public void TMain1()
{
}
[TestMethod]
public void TestMeth1()
{
}
[Transaction(Etranstype.TRANSTYPE_MAIN)]
public void TMain2()
{
}
[TestMethod]
public void TestMeth2()
{
}
[TestMethod]
public void TestMeth3()
{
}
|
dcltrans
transaction TMain1
begin
DotNetCallMethod(hVuser1, "TMain1");
DotNetCallMethod(hVuser1, "TestMeth1");
end;
transaction TMain2
begin
DotNetCallMethod(hVuser1, "TMain2");
DotNetCallMethod(hVuser1, "TestMeth2");
DotNetCallMethod(hVuser1, "TestMeth3");
end;
|
[TestMethod]
public void TestMeth1()
{}
[Transaction(Etranstype.TRANSTYPE_MAIN)]
public void TMain1()
{}