|
From: Michael D. <mik...@us...> - 2004-04-12 05:59:07
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate.Test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11183/NHibernate.Test Modified Files: NHibernate.Test-1.1.csproj Added Files: NH47.cs Log Message: Added test for Template and StringHelper. Added test for an issue (will probably remove later because I misunderstood the issue) --- NEW FILE: NH47.cs --- using System; using System.Data; using System.Collections; using NHibernate; using NExp = NHibernate.Expression; using NHibernate.DomainModel; using NUnit.Framework; namespace NHibernate.Test { [TestFixture] public class NH47Fxiture : TestCase { [SetUp] public void SetUp() { ExportSchema( new string[] { "UnsavedType.hbm.xml"}); } public TimeSpan BatchInsert(object[] objs) { System.TimeSpan tspan = TimeSpan.Zero; if (objs != null && objs.Length > 0) { ISession s = sessions.OpenSession(); ITransaction t = s.BeginTransaction(); int count = objs.Length; Console.WriteLine(); Console.WriteLine("Start batch insert " + count.ToString() + " objects"); DateTime startTime = DateTime.Now; for(int i = 0; i < count; ++i) { s.Save(objs[i]); } t.Commit(); s.Close(); tspan = DateTime.Now.Subtract(startTime); Console.WriteLine("Finish in " + tspan.TotalMilliseconds.ToString() + " milliseconds"); } return tspan; } [Test] [Ignore("Only run this by itself")] public void TestNH47() { int testCount = 100; object[] al = new object[testCount]; TimeSpan tspan = TimeSpan.Zero; int times = 1000; for (int i = 0; i < times; ++i) { for (int j = 0; j < testCount; ++j) { UnsavedType ut = new UnsavedType(); ut.Id = j + 1 + testCount * (i + 1); ut.TypeName = System.Guid.NewGuid().ToString(); al[j] = ut; } tspan = tspan.Add(BatchInsert(al)); } Console.WriteLine("Finish average in " + (tspan.TotalMilliseconds / times).ToString() + " milliseconds for " + times.ToString() + " times"); Console.Read(); } } } Index: NHibernate.Test-1.1.csproj =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate.Test/NHibernate.Test-1.1.csproj,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** NHibernate.Test-1.1.csproj 9 Apr 2004 13:39:46 -0000 1.12 --- NHibernate.Test-1.1.csproj 12 Apr 2004 05:45:21 -0000 1.13 *************** *** 165,168 **** --- 165,173 ---- /> <File + RelPath = "NH47.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File RelPath = "NHibernate.Test.build" BuildAction = "None" *************** *** 293,296 **** --- 298,306 ---- /> <File + RelPath = "SqlCommandTest\TemplateFixture.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File RelPath = "TypesTest\BaseTypeFixture.cs" SubType = "Code" *************** *** 317,320 **** --- 327,335 ---- BuildAction = "Compile" /> + <File + RelPath = "UtilityTest\StringHelperFixture.cs" + SubType = "Code" + BuildAction = "Compile" + /> </Include> </Files> |