forked from nhibernate/fluent-nhibernate
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Modified the IdentityStep class to specify the access method of an Id…
…Mapping as a default only, so that a convention can override the value.
- Loading branch information
Showing
3 changed files
with
40 additions
and
1 deletion.
There are no files selected for viewing
38 changes: 38 additions & 0 deletions
38
src/FluentNHibernate.Testing/AutoMapping/Steps/IdentityStepTests.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using FluentNHibernate.MappingModel.Identity; | ||
using NUnit.Framework; | ||
using FluentNHibernate.Automapping.Steps; | ||
using FluentNHibernate.Automapping; | ||
using FluentNHibernate.MappingModel.ClassBased; | ||
using FluentNHibernate.Utils.Reflection; | ||
|
||
namespace FluentNHibernate.Testing.AutoMapping.Steps | ||
{ | ||
[TestFixture] | ||
public class IdentityStepTests | ||
{ | ||
[Test] | ||
public void IdentityStepShouldProvideAnAccessValueThatIsADefaultOnly() | ||
{ | ||
IdentityStep step = new IdentityStep(new DefaultAutomappingConfiguration()); | ||
|
||
var classMapping = new ClassMapping() {Type = typeof(ClassWithIdFieldAndGetter)}; | ||
step.Map(classMapping, ReflectionHelper.GetMember<ClassWithIdFieldAndGetter>(x => x.Id)); | ||
|
||
var idMapping = (IdMapping) classMapping.Id; | ||
idMapping.HasValue("Access").ShouldBeTrue(); | ||
idMapping.IsSpecified(x => x.Access).ShouldBeFalse(); | ||
} | ||
|
||
private class ClassWithIdFieldAndGetter | ||
{ | ||
#pragma warning disable 649 | ||
int _id; | ||
#pragma warning restore 649 | ||
public int Id { get { return _id; } } | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters