From: <fab...@us...> - 2011-04-07 19:44:28
|
Revision: 5632 http://nhibernate.svn.sourceforge.net/nhibernate/?rev=5632&view=rev Author: fabiomaulo Date: 2011-04-07 19:44:21 +0000 (Thu, 07 Apr 2011) Log Message: ----------- Base test class to work with sexy mapping Modified Paths: -------------- trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj trunk/nhibernate/src/NHibernate.Test/TestCase.cs Added Paths: ----------- trunk/nhibernate/src/NHibernate.Test/TestCaseMappingByCode.cs Modified: trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj =================================================================== --- trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj 2011-04-07 19:30:49 UTC (rev 5631) +++ trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj 2011-04-07 19:44:21 UTC (rev 5632) @@ -749,6 +749,7 @@ <Compile Include="ReadOnly\VersionedNode.cs" /> <Compile Include="Subselect\ClassSubselectFixture.cs" /> <Compile Include="Subselect\Domain.cs" /> + <Compile Include="TestCaseMappingByCode.cs" /> <Compile Include="TestDialect.cs" /> <Compile Include="TestDialects\PostgreSQL82TestDialect.cs" /> <Compile Include="TestDialects\SQLiteTestDialect.cs" /> Modified: trunk/nhibernate/src/NHibernate.Test/TestCase.cs =================================================================== --- trunk/nhibernate/src/NHibernate.Test/TestCase.cs 2011-04-07 19:30:49 UTC (rev 5631) +++ trunk/nhibernate/src/NHibernate.Test/TestCase.cs 2011-04-07 19:44:21 UTC (rev 5632) @@ -222,16 +222,21 @@ if (TestConfigurationHelper.hibernateConfigFile != null) cfg.Configure(TestConfigurationHelper.hibernateConfigFile); + AddMappings(cfg); + + Configure(cfg); + + ApplyCacheSettings(cfg); + } + + protected virtual void AddMappings(Configuration configuration) + { Assembly assembly = Assembly.Load(MappingsAssembly); foreach (string file in Mappings) { - cfg.AddResource(MappingsAssembly + "." + file, assembly); + configuration.AddResource(MappingsAssembly + "." + file, assembly); } - - Configure(cfg); - - ApplyCacheSettings(cfg); } protected virtual void CreateSchema() Added: trunk/nhibernate/src/NHibernate.Test/TestCaseMappingByCode.cs =================================================================== --- trunk/nhibernate/src/NHibernate.Test/TestCaseMappingByCode.cs (rev 0) +++ trunk/nhibernate/src/NHibernate.Test/TestCaseMappingByCode.cs 2011-04-07 19:44:21 UTC (rev 5632) @@ -0,0 +1,25 @@ +using System.Collections; +using NHibernate.Cfg.MappingSchema; + +namespace NHibernate.Test +{ + public abstract class TestCaseMappingByCode:TestCase + { + protected override IList Mappings + { + get { return new string[0]; } + } + + protected override string MappingsAssembly + { + get { return null; } + } + + protected override void AddMappings(Cfg.Configuration configuration) + { + configuration.AddDeserializedMapping(GetMappings(), "TestDomain"); + } + + protected abstract HbmMapping GetMappings(); + } +} \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |