MyPDO 2 0 支援業務邏輯層事務

2021-03-31 20:43:22 字數 1217 閱讀 4399

mypdo 2.0 支援業務邏輯層事務

檔案 trans1.cs

using system;

using nunit.framework;

using mypdo.dataaccess;

namespace testdata

private mypdo.dataaccess.dataaccessor dba;

public mypdo.dataaccess.dataaccessor data

set}

[setup]

public void setup()

public int insert()}}

檔案 trans2.cs

using system;

using nunit.framework;

using mypdo.dataaccess;

namespace testdata

private mypdo.dataaccess.dataaccessor dba;

public mypdo.dataaccess.dataaccessor data

set}

[setup]

public void setup()

public int insert()

assert.istrue(2 ==i);

//if(i==2)

// dba.***mittrans();

//else

// dba.rollbacktrans();

return i;

}private int insert()}}

檔案 testdata.cs

using system;

using nunit.framework;

using mypdo.dataaccess;

namespace testdata

private mypdo.dataaccess.dataaccessor dba;

[setup]

public void setup()

[test]

public void trans_test()

}if(i==4)

dba.***mittrans();

else

dba.rollbacktrans();

console.write(i.tostring()+ "/n");}}

}