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.
Conflicts: src/FluentNHibernate/Visitors/NullMappingModelVisitor.cs
- Loading branch information
Showing
35 changed files
with
664 additions
and
39 deletions.
There are no files selected for viewing
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
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
61 changes: 61 additions & 0 deletions
61
src/FluentNHibernate.Testing/FluentInterfaceTests/NaturalIdPartTests.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,61 @@ | ||
using System.Linq; | ||
using FluentNHibernate.Mapping; | ||
using FluentNHibernate.MappingModel; | ||
using NUnit.Framework; | ||
using FluentNHibernate.Testing.DomainModel.Mapping; | ||
|
||
namespace FluentNHibernate.Testing.FluentInterfaceTests | ||
{ | ||
[TestFixture] | ||
public class NaturalIdPartTests : BaseModelFixture | ||
{ | ||
[Test] | ||
public void ShouldMapProperty() | ||
{ | ||
NaturalId<PropertyTarget>() | ||
.Mapping(m => m.Property(x => x.DecimalProperty)) | ||
.ModelShouldMatch(x => x.Properties.Single().Name.ShouldEqual("DecimalProperty")); | ||
} | ||
|
||
[Test] | ||
public void ShouldMapPropertyWithColumnName() | ||
{ | ||
NaturalId<PropertyTarget>() | ||
.Mapping(m => m.Property(x => x.DecimalProperty, "CustomCol")) | ||
.ModelShouldMatch(x => x.Properties.Single().Columns.Single().Name.ShouldEqual("CustomCol")); | ||
} | ||
|
||
[Test] | ||
public void ShouldMapReference() | ||
{ | ||
NaturalId<PropertyTarget>() | ||
.Mapping(m => m.Reference(x => x.Reference)) | ||
.ModelShouldMatch(x => x.ManyToOnes.Single().Name.ShouldEqual("Reference")); | ||
} | ||
|
||
[Test] | ||
public void ShouldMapReferenceWithColumnName() | ||
{ | ||
NaturalId<PropertyTarget>() | ||
.Mapping(m => m.Reference(x => x.Reference, "CustomCol")) | ||
.ModelShouldMatch(x => x.ManyToOnes.Single().Columns.Single().Name.ShouldEqual("CustomCol")); | ||
} | ||
|
||
[Test] | ||
public void ShouldSetReadOnly() | ||
{ | ||
NaturalId<PropertyTarget>() | ||
.Mapping(m => m.ReadOnly()) | ||
.ModelShouldMatch(x => x.Mutable.ShouldBeFalse()); | ||
} | ||
|
||
[Test] | ||
public void ShouldSetNotReadOnly() | ||
{ | ||
NaturalId<PropertyTarget>() | ||
.Mapping(m => m.Not.ReadOnly()) | ||
.ModelShouldMatch(x => x.Mutable.ShouldBeTrue()); | ||
} | ||
|
||
} | ||
} |
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
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
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
54 changes: 54 additions & 0 deletions
54
src/FluentNHibernate.Testing/MappingModel/Output/XmlNaturalIdWriterTester.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,54 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using NUnit.Framework; | ||
using FluentNHibernate.MappingModel; | ||
using FluentNHibernate.MappingModel.Output; | ||
using FluentNHibernate.Testing.Testing; | ||
|
||
namespace FluentNHibernate.Testing.MappingModel.Output | ||
{ | ||
[TestFixture] | ||
public class XmlNaturalIdWriterTester | ||
{ | ||
private IXmlWriter<NaturalIdMapping> writer; | ||
|
||
[SetUp] | ||
public void GetWriterFromContainer() | ||
{ | ||
var container = new XmlWriterContainer(); | ||
writer = container.Resolve<IXmlWriter<NaturalIdMapping>>(); | ||
} | ||
|
||
[Test] | ||
public void ShouldWriteMutableAttribute() | ||
{ | ||
var testHelper = new XmlWriterTestHelper<NaturalIdMapping>(); | ||
|
||
testHelper.Check(x => x.Mutable, true).MapsToAttribute("mutable"); | ||
testHelper.VerifyAll(writer); | ||
} | ||
|
||
[Test] | ||
public void ShouldWriteProperties() | ||
{ | ||
var mapping = new NaturalIdMapping(); | ||
mapping.AddProperty(new PropertyMapping()); | ||
|
||
writer.VerifyXml(mapping) | ||
.Element("property").Exists(); | ||
} | ||
|
||
[Test] | ||
public void ShouldWriteManyToOnes() | ||
{ | ||
var mapping = new NaturalIdMapping(); | ||
mapping.AddReference(new ManyToOneMapping()); | ||
|
||
writer.VerifyXml(mapping) | ||
.Element("many-to-one").Exists(); | ||
} | ||
|
||
} | ||
} |
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
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
Oops, something went wrong.