|
From: <fab...@us...> - 2011-04-03 14:46:25
|
Revision: 5593
http://nhibernate.svn.sourceforge.net/nhibernate/?rev=5593&view=rev
Author: fabiomaulo
Date: 2011-04-03 14:46:14 +0000 (Sun, 03 Apr 2011)
Log Message:
-----------
Minor (reorganized namespace)
Modified Paths:
--------------
trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj
Added Paths:
-----------
trunk/nhibernate/src/NHibernate.Test/MappingByCode/ExpliticMappingTests/
trunk/nhibernate/src/NHibernate.Test/MappingByCode/ExpliticMappingTests/BasicMappingOfSimpleClass.cs
trunk/nhibernate/src/NHibernate.Test/MappingByCode/ExpliticMappingTests/ColumnsNamingConvetions.cs
trunk/nhibernate/src/NHibernate.Test/MappingByCode/ExpliticMappingTests/MappingOfPrivateMembersOnRootEntity.cs
Removed Paths:
-------------
trunk/nhibernate/src/NHibernate.Test/MappingByCode/BasicMappingOfSimpleClass.cs
trunk/nhibernate/src/NHibernate.Test/MappingByCode/ColumnsNamingConvetions.cs
trunk/nhibernate/src/NHibernate.Test/MappingByCode/MappingOfPrivateMembersOnRootEntity.cs
Deleted: trunk/nhibernate/src/NHibernate.Test/MappingByCode/BasicMappingOfSimpleClass.cs
===================================================================
--- trunk/nhibernate/src/NHibernate.Test/MappingByCode/BasicMappingOfSimpleClass.cs 2011-04-03 14:03:09 UTC (rev 5592)
+++ trunk/nhibernate/src/NHibernate.Test/MappingByCode/BasicMappingOfSimpleClass.cs 2011-04-03 14:46:14 UTC (rev 5593)
@@ -1,98 +0,0 @@
-using System.Linq;
-using NHibernate.Cfg.MappingSchema;
-using NHibernate.Mapping.ByCode;
-using NHibernate.Mapping.ByCode.Impl;
-using NUnit.Framework;
-using SharpTestsEx;
-
-namespace NHibernate.Test.MappingByCode
-{
- public class BasicMappingOfSimpleClass
- {
- public class MyClass
- {
- public int Id { get; set; }
- public string Something { get; set; }
- }
-
- [Test]
- public void MapClassWithIdAndProperty()
- {
- var mapper = new ModelMapper();
- mapper.Class<MyClass>(ca =>
- {
- ca.Id(x => x.Id, map =>
- {
- map.Column("MyClassId");
- map.Generator(Generators.HighLow, gmap => gmap.Params(new { max_low = 100 }));
- });
- ca.Property(x => x.Something, map => map.Length(150));
- });
- var hbmMapping = mapper.CompileMappingFor(new[] { typeof(MyClass) });
- ModelIsWellFormed(hbmMapping);
- }
-
- [Test]
- public void WhenDuplicatePropertiesDoesNotDuplicateMapping()
- {
- var mapper = new ModelMapper();
- mapper.Class<MyClass>(ca =>
- {
- ca.Id(x => x.Id, map =>
- {
- map.Column("MyClassId");
- });
- ca.Id(x => x.Id, map =>
- {
- map.Generator(Generators.HighLow, gmap => gmap.Params(new { max_low = 100 }));
- });
- ca.Property(x => x.Something);
- ca.Property(x => x.Something, map => map.Length(150));
- });
- var hbmMapping = mapper.CompileMappingFor(new[] { typeof(MyClass) });
- ModelIsWellFormed(hbmMapping);
- }
-
- [Test]
- public void WhenDuplicateClassDoesNotDuplicateMapping()
- {
- var mapper = new ModelMapper();
- mapper.Class<MyClass>(ca =>
- {
- ca.Id(x => x.Id, map =>
- {
- map.Generator(Generators.HighLow, gmap => gmap.Params(new { max_low = 100 }));
- });
- ca.Property(x => x.Something);
- });
-
- mapper.Class<MyClass>(ca =>
- {
- ca.Id(x => x.Id, map =>
- {
- map.Column("MyClassId");
- });
- ca.Property(x => x.Something, map => map.Length(150));
- });
- var hbmMapping = mapper.CompileMappingFor(new[] { typeof(MyClass) });
- ModelIsWellFormed(hbmMapping);
- }
-
- private void ModelIsWellFormed(HbmMapping hbmMapping)
- {
- var hbmClass = hbmMapping.RootClasses[0];
- hbmClass.Should().Not.Be.Null();
- var hbmId = hbmClass.Id;
- hbmId.Should().Not.Be.Null();
- hbmId.name.Should().Be("Id");
- var hbmGenerator = hbmId.generator;
- hbmGenerator.Should().Not.Be.Null();
- hbm...@cl...().Be("hilo");
- hbmGenerator.param[0].name.Should().Be("max_low");
- hbmGenerator.param[0].GetText().Should().Be("100");
- var hbmProperty = hbmClass.Properties.OfType<HbmProperty>().Single();
- hbmProperty.name.Should().Be("Something");
- hbmProperty.length.Should().Be("150");
- }
- }
-}
\ No newline at end of file
Deleted: trunk/nhibernate/src/NHibernate.Test/MappingByCode/ColumnsNamingConvetions.cs
===================================================================
--- trunk/nhibernate/src/NHibernate.Test/MappingByCode/ColumnsNamingConvetions.cs 2011-04-03 14:03:09 UTC (rev 5592)
+++ trunk/nhibernate/src/NHibernate.Test/MappingByCode/ColumnsNamingConvetions.cs 2011-04-03 14:46:14 UTC (rev 5593)
@@ -1,67 +0,0 @@
-using System.Linq;
-using NHibernate.Cfg.MappingSchema;
-using NHibernate.Mapping.ByCode;
-using NUnit.Framework;
-using SharpTestsEx;
-
-namespace NHibernate.Test.MappingByCode
-{
- public class ColumnsNamingConvetions
- {
- public class MyClass
- {
- public int Id { get; set; }
- public string Something { get; set; }
- }
-
- [Test]
- public void MapClassWithConventions()
- {
- var mapper = new ModelMapper();
-
- mapper.BeforeMapClass +=
- (mi, t, map) => map.Id(x => x.Column((t.Name+"id").ToUpper()));
- mapper.BeforeMapProperty +=
- (mi, propertyPath, map) => map.Column(propertyPath.ToColumnName().ToUpper());
-
- mapper.Class<MyClass>(ca =>
- {
- ca.Id(x => x.Id, map => { });
- ca.Property(x => x.Something);
- });
- var hbmMapping = mapper.CompileMappingFor(new[] { typeof(MyClass) });
-
- var hbmClass = hbmMapping.RootClasses[0];
- hbmClass.Should().Not.Be.Null();
- var hbmId = hbmClass.Id;
- hbmId.column1.Should().Be("MYCLASSID");
- var hbmProperty = hbmClass.Properties.OfType<HbmProperty>().Single();
- hbmProperty.column.Should().Be("SOMETHING");
- }
-
- [Test]
- public void MapClassWithHardConventions()
- {
- var mapper = new ModelMapper();
-
- mapper.AfterMapClass +=
- (mi, t, map) => map.Id(x => x.Column((t.Name + "id").ToUpper()));
- mapper.AfterMapProperty +=
- (mi, propertyPath, map) => map.Column(propertyPath.ToColumnName().ToUpper());
-
- mapper.Class<MyClass>(ca =>
- {
- ca.Id(x => x.Id, map => map.Column("Whatever"));
- ca.Property(x => x.Something, map => map.Column("Whatever"));
- });
- var hbmMapping = mapper.CompileMappingFor(new[] { typeof(MyClass) });
-
- var hbmClass = hbmMapping.RootClasses[0];
- hbmClass.Should().Not.Be.Null();
- var hbmId = hbmClass.Id;
- hbmId.column1.Should().Be("MYCLASSID");
- var hbmProperty = hbmClass.Properties.OfType<HbmProperty>().Single();
- hbmProperty.column.Should().Be("SOMETHING");
- }
- }
-}
\ No newline at end of file
Copied: trunk/nhibernate/src/NHibernate.Test/MappingByCode/ExpliticMappingTests/BasicMappingOfSimpleClass.cs (from rev 5587, trunk/nhibernate/src/NHibernate.Test/MappingByCode/BasicMappingOfSimpleClass.cs)
===================================================================
--- trunk/nhibernate/src/NHibernate.Test/MappingByCode/ExpliticMappingTests/BasicMappingOfSimpleClass.cs (rev 0)
+++ trunk/nhibernate/src/NHibernate.Test/MappingByCode/ExpliticMappingTests/BasicMappingOfSimpleClass.cs 2011-04-03 14:46:14 UTC (rev 5593)
@@ -0,0 +1,97 @@
+using System.Linq;
+using NHibernate.Cfg.MappingSchema;
+using NHibernate.Mapping.ByCode;
+using NUnit.Framework;
+using SharpTestsEx;
+
+namespace NHibernate.Test.MappingByCode.ExpliticMappingTests
+{
+ public class BasicMappingOfSimpleClass
+ {
+ public class MyClass
+ {
+ public int Id { get; set; }
+ public string Something { get; set; }
+ }
+
+ [Test]
+ public void MapClassWithIdAndProperty()
+ {
+ var mapper = new ModelMapper();
+ mapper.Class<MyClass>(ca =>
+ {
+ ca.Id(x => x.Id, map =>
+ {
+ map.Column("MyClassId");
+ map.Generator(Generators.HighLow, gmap => gmap.Params(new { max_low = 100 }));
+ });
+ ca.Property(x => x.Something, map => map.Length(150));
+ });
+ var hbmMapping = mapper.CompileMappingFor(new[] { typeof(MyClass) });
+ ModelIsWellFormed(hbmMapping);
+ }
+
+ [Test]
+ public void WhenDuplicatePropertiesDoesNotDuplicateMapping()
+ {
+ var mapper = new ModelMapper();
+ mapper.Class<MyClass>(ca =>
+ {
+ ca.Id(x => x.Id, map =>
+ {
+ map.Column("MyClassId");
+ });
+ ca.Id(x => x.Id, map =>
+ {
+ map.Generator(Generators.HighLow, gmap => gmap.Params(new { max_low = 100 }));
+ });
+ ca.Property(x => x.Something);
+ ca.Property(x => x.Something, map => map.Length(150));
+ });
+ var hbmMapping = mapper.CompileMappingFor(new[] { typeof(MyClass) });
+ ModelIsWellFormed(hbmMapping);
+ }
+
+ [Test]
+ public void WhenDuplicateClassDoesNotDuplicateMapping()
+ {
+ var mapper = new ModelMapper();
+ mapper.Class<MyClass>(ca =>
+ {
+ ca.Id(x => x.Id, map =>
+ {
+ map.Generator(Generators.HighLow, gmap => gmap.Params(new { max_low = 100 }));
+ });
+ ca.Property(x => x.Something);
+ });
+
+ mapper.Class<MyClass>(ca =>
+ {
+ ca.Id(x => x.Id, map =>
+ {
+ map.Column("MyClassId");
+ });
+ ca.Property(x => x.Something, map => map.Length(150));
+ });
+ var hbmMapping = mapper.CompileMappingFor(new[] { typeof(MyClass) });
+ ModelIsWellFormed(hbmMapping);
+ }
+
+ private void ModelIsWellFormed(HbmMapping hbmMapping)
+ {
+ var hbmClass = hbmMapping.RootClasses[0];
+ hbmClass.Should().Not.Be.Null();
+ var hbmId = hbmClass.Id;
+ hbmId.Should().Not.Be.Null();
+ hbmId.name.Should().Be("Id");
+ var hbmGenerator = hbmId.generator;
+ hbmGenerator.Should().Not.Be.Null();
+ hbm...@cl...().Be("hilo");
+ hbmGenerator.param[0].name.Should().Be("max_low");
+ hbmGenerator.param[0].GetText().Should().Be("100");
+ var hbmProperty = hbmClass.Properties.OfType<HbmProperty>().Single();
+ hbmProperty.name.Should().Be("Something");
+ hbmProperty.length.Should().Be("150");
+ }
+ }
+}
\ No newline at end of file
Copied: trunk/nhibernate/src/NHibernate.Test/MappingByCode/ExpliticMappingTests/ColumnsNamingConvetions.cs (from rev 5587, trunk/nhibernate/src/NHibernate.Test/MappingByCode/ColumnsNamingConvetions.cs)
===================================================================
--- trunk/nhibernate/src/NHibernate.Test/MappingByCode/ExpliticMappingTests/ColumnsNamingConvetions.cs (rev 0)
+++ trunk/nhibernate/src/NHibernate.Test/MappingByCode/ExpliticMappingTests/ColumnsNamingConvetions.cs 2011-04-03 14:46:14 UTC (rev 5593)
@@ -0,0 +1,67 @@
+using System.Linq;
+using NHibernate.Cfg.MappingSchema;
+using NHibernate.Mapping.ByCode;
+using NUnit.Framework;
+using SharpTestsEx;
+
+namespace NHibernate.Test.MappingByCode.ExpliticMappingTests
+{
+ public class ColumnsNamingConvetions
+ {
+ public class MyClass
+ {
+ public int Id { get; set; }
+ public string Something { get; set; }
+ }
+
+ [Test]
+ public void MapClassWithConventions()
+ {
+ var mapper = new ModelMapper();
+
+ mapper.BeforeMapClass +=
+ (mi, t, map) => map.Id(x => x.Column((t.Name+"id").ToUpper()));
+ mapper.BeforeMapProperty +=
+ (mi, propertyPath, map) => map.Column(propertyPath.ToColumnName().ToUpper());
+
+ mapper.Class<MyClass>(ca =>
+ {
+ ca.Id(x => x.Id, map => { });
+ ca.Property(x => x.Something);
+ });
+ var hbmMapping = mapper.CompileMappingFor(new[] { typeof(MyClass) });
+
+ var hbmClass = hbmMapping.RootClasses[0];
+ hbmClass.Should().Not.Be.Null();
+ var hbmId = hbmClass.Id;
+ hbmId.column1.Should().Be("MYCLASSID");
+ var hbmProperty = hbmClass.Properties.OfType<HbmProperty>().Single();
+ hbmProperty.column.Should().Be("SOMETHING");
+ }
+
+ [Test]
+ public void MapClassWithHardConventions()
+ {
+ var mapper = new ModelMapper();
+
+ mapper.AfterMapClass +=
+ (mi, t, map) => map.Id(x => x.Column((t.Name + "id").ToUpper()));
+ mapper.AfterMapProperty +=
+ (mi, propertyPath, map) => map.Column(propertyPath.ToColumnName().ToUpper());
+
+ mapper.Class<MyClass>(ca =>
+ {
+ ca.Id(x => x.Id, map => map.Column("Whatever"));
+ ca.Property(x => x.Something, map => map.Column("Whatever"));
+ });
+ var hbmMapping = mapper.CompileMappingFor(new[] { typeof(MyClass) });
+
+ var hbmClass = hbmMapping.RootClasses[0];
+ hbmClass.Should().Not.Be.Null();
+ var hbmId = hbmClass.Id;
+ hbmId.column1.Should().Be("MYCLASSID");
+ var hbmProperty = hbmClass.Properties.OfType<HbmProperty>().Single();
+ hbmProperty.column.Should().Be("SOMETHING");
+ }
+ }
+}
\ No newline at end of file
Copied: trunk/nhibernate/src/NHibernate.Test/MappingByCode/ExpliticMappingTests/MappingOfPrivateMembersOnRootEntity.cs (from rev 5587, trunk/nhibernate/src/NHibernate.Test/MappingByCode/MappingOfPrivateMembersOnRootEntity.cs)
===================================================================
--- trunk/nhibernate/src/NHibernate.Test/MappingByCode/ExpliticMappingTests/MappingOfPrivateMembersOnRootEntity.cs (rev 0)
+++ trunk/nhibernate/src/NHibernate.Test/MappingByCode/ExpliticMappingTests/MappingOfPrivateMembersOnRootEntity.cs 2011-04-03 14:46:14 UTC (rev 5593)
@@ -0,0 +1,48 @@
+using System.Linq;
+using NHibernate.Cfg.MappingSchema;
+using NHibernate.Mapping.ByCode;
+using NUnit.Framework;
+using SharpTestsEx;
+
+namespace NHibernate.Test.MappingByCode.ExpliticMappingTests
+{
+ public class MappingOfPrivateMembersOnRootEntity
+ {
+ public class MyClass
+ {
+ private int id;
+ private string something;
+ }
+
+ [Test]
+ public void MapClassWithIdAndProperty()
+ {
+ var mapper = new ModelMapper();
+ mapper.Class<MyClass>(ca =>
+ {
+ ca.Id(ForClass<MyClass>.Field("id"), map =>
+ {
+ map.Column("MyClassId");
+ map.Generator(Generators.HighLow, gmap => gmap.Params(new { max_low = 100 }));
+ });
+ ca.Property(ForClass<MyClass>.Field("something"), map => map.Length(150));
+ });
+ var hbmMapping = mapper.CompileMappingFor(new[] { typeof(MyClass) });
+ var hbmClass = hbmMapping.RootClasses[0];
+ hbmClass.Should().Not.Be.Null();
+ var hbmId = hbmClass.Id;
+ hbmId.Should().Not.Be.Null();
+ hbmId.name.Should().Be("id");
+ hbmId.access.Should().Be("field");
+ var hbmGenerator = hbmId.generator;
+ hbmGenerator.Should().Not.Be.Null();
+ hbm...@cl...().Be("hilo");
+ hbmGenerator.param[0].name.Should().Be("max_low");
+ hbmGenerator.param[0].GetText().Should().Be("100");
+ var hbmProperty = hbmClass.Properties.OfType<HbmProperty>().Single();
+ hbmProperty.name.Should().Be("something");
+ hbmProperty.access.Should().Be("field");
+ hbmProperty.length.Should().Be("150");
+ }
+ }
+}
\ No newline at end of file
Deleted: trunk/nhibernate/src/NHibernate.Test/MappingByCode/MappingOfPrivateMembersOnRootEntity.cs
===================================================================
--- trunk/nhibernate/src/NHibernate.Test/MappingByCode/MappingOfPrivateMembersOnRootEntity.cs 2011-04-03 14:03:09 UTC (rev 5592)
+++ trunk/nhibernate/src/NHibernate.Test/MappingByCode/MappingOfPrivateMembersOnRootEntity.cs 2011-04-03 14:46:14 UTC (rev 5593)
@@ -1,49 +0,0 @@
-using System.Linq;
-using NHibernate.Cfg.MappingSchema;
-using NHibernate.Mapping.ByCode;
-using NHibernate.Mapping.ByCode.Impl;
-using NUnit.Framework;
-using SharpTestsEx;
-
-namespace NHibernate.Test.MappingByCode
-{
- public class MappingOfPrivateMembersOnRootEntity
- {
- public class MyClass
- {
- private int id;
- private string something;
- }
-
- [Test]
- public void MapClassWithIdAndProperty()
- {
- var mapper = new ModelMapper();
- mapper.Class<MyClass>(ca =>
- {
- ca.Id(ForClass<MyClass>.Field("id"), map =>
- {
- map.Column("MyClassId");
- map.Generator(Generators.HighLow, gmap => gmap.Params(new { max_low = 100 }));
- });
- ca.Property(ForClass<MyClass>.Field("something"), map => map.Length(150));
- });
- var hbmMapping = mapper.CompileMappingFor(new[] { typeof(MyClass) });
- var hbmClass = hbmMapping.RootClasses[0];
- hbmClass.Should().Not.Be.Null();
- var hbmId = hbmClass.Id;
- hbmId.Should().Not.Be.Null();
- hbmId.name.Should().Be("id");
- hbmId.access.Should().Be("field");
- var hbmGenerator = hbmId.generator;
- hbmGenerator.Should().Not.Be.Null();
- hbm...@cl...().Be("hilo");
- hbmGenerator.param[0].name.Should().Be("max_low");
- hbmGenerator.param[0].GetText().Should().Be("100");
- var hbmProperty = hbmClass.Properties.OfType<HbmProperty>().Single();
- hbmProperty.name.Should().Be("something");
- hbmProperty.access.Should().Be("field");
- hbmProperty.length.Should().Be("150");
- }
- }
-}
\ No newline at end of file
Modified: trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj
===================================================================
--- trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj 2011-04-03 14:03:09 UTC (rev 5592)
+++ trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj 2011-04-03 14:46:14 UTC (rev 5593)
@@ -506,8 +506,8 @@
<Compile Include="Linq\ByMethod\SumTests.cs" />
<Compile Include="Logging\Log4NetLoggerTest.cs" />
<Compile Include="Logging\LoggerProviderTest.cs" />
- <Compile Include="MappingByCode\BasicMappingOfSimpleClass.cs" />
- <Compile Include="MappingByCode\ColumnsNamingConvetions.cs" />
+ <Compile Include="MappingByCode\ExpliticMappingTests\BasicMappingOfSimpleClass.cs" />
+ <Compile Include="MappingByCode\ExpliticMappingTests\ColumnsNamingConvetions.cs" />
<Compile Include="MappingByCode\ExplicitlyDeclaredModelTests\ComponentMappingRegistrationTests.cs" />
<Compile Include="MappingByCode\ExplicitlyDeclaredModelTests\JoinedSubclassMappingStrategyTests.cs" />
<Compile Include="MappingByCode\ExplicitlyDeclaredModelTests\JoinedSubclassSequenceRegistrationTests.cs" />
@@ -518,7 +518,7 @@
<Compile Include="MappingByCode\ExplicitlyDeclaredModelTests\SubclassSequenceRegistrationTests.cs" />
<Compile Include="MappingByCode\ExplicitlyDeclaredModelTests\UnionSubclassMappingStrategyTests.cs" />
<Compile Include="MappingByCode\ExplicitlyDeclaredModelTests\UnionSubclassSequenceRegistrationTests.cs" />
- <Compile Include="MappingByCode\MappingOfPrivateMembersOnRootEntity.cs" />
+ <Compile Include="MappingByCode\ExpliticMappingTests\MappingOfPrivateMembersOnRootEntity.cs" />
<Compile Include="MappingByCode\NatureDemo\Naturalness\Address.cs" />
<Compile Include="MappingByCode\NatureDemo\Naturalness\Animal.cs" />
<Compile Include="MappingByCode\NatureDemo\Naturalness\Classification.cs" />
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|