From: Peter S. <sz...@us...> - 2004-04-06 13:49:07
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate.Test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19133/NHibernate.Test Modified Files: ABCProxyTest.cs ABCTest.cs TestCase.cs Log Message: Added executestatement to testcase and to testcases. Modified hbms' doctype accordingly. Index: TestCase.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate.Test/TestCase.cs,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** TestCase.cs 6 Apr 2004 12:56:39 -0000 1.3 --- TestCase.cs 6 Apr 2004 13:36:18 -0000 1.4 *************** *** 40,44 **** public void ExecuteStatement(string sql) { ! SqlConnection conn = new SqlConnection(""); } } --- 40,72 ---- public void ExecuteStatement(string sql) { ! ExecuteStatement(sql, true); ! } ! ! public void ExecuteStatement(string sql, bool error) ! { ! SqlConnection conn = null; ! SqlTransaction tran = null; ! try ! { ! conn = new SqlConnection("Server=localhost;initial catalog=nhibernate;User ID=someuser;Password=somepwd"); ! conn.Open(); ! tran = conn.BeginTransaction(); ! System.Data.SqlClient.SqlCommand comm = conn.CreateCommand(); ! comm.CommandText = sql; ! comm.Transaction = tran; ! comm.CommandType = CommandType.Text; ! comm.ExecuteNonQuery(); ! tran.Commit(); ! } ! catch ! { ! tran.Rollback(); ! if (error) ! throw; ! } ! finally ! { ! conn.Close(); ! } } } Index: ABCProxyTest.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate.Test/ABCProxyTest.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ABCProxyTest.cs 6 Apr 2004 10:51:42 -0000 1.1 --- ABCProxyTest.cs 6 Apr 2004 13:36:18 -0000 1.2 *************** *** 13,16 **** --- 13,19 ---- public void SetUp() { + ExecuteStatement("drop table D", false); + ExecuteStatement("drop table A", false); + ExecuteStatement("drop table map", false); ExportSchema(new string[] { "ABCProxy.hbm.xml"}); } Index: ABCTest.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate.Test/ABCTest.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ABCTest.cs 6 Apr 2004 12:56:39 -0000 1.1 --- ABCTest.cs 6 Apr 2004 13:36:18 -0000 1.2 *************** *** 16,19 **** --- 16,22 ---- public void SetUp() { + ExecuteStatement("drop table D", false); + ExecuteStatement("drop table A", false); + ExecuteStatement("drop table map", false); ExportSchema(new string[] { "ABC.hbm.xml"}); } |