Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Allow VerifyTheMappings to accept an instance.

  • Loading branch information...
commit fcdd5b699fd752a83717d4426bdd860ac19ee5dc 1 parent f4b55a5
Barry Dahlberg authored paulbatum committed
View
7 src/FluentNHibernate.Testing/Testing/PersistenceSpecificationTester.cs
@@ -207,6 +207,13 @@ public void Should_reject_classes_without_a_parameterless_constructor()
_spec.VerifyTheMappings());
}
+ [Test]
+ public void Should_accept_instances_regardless_of_constructor()
+ {
+ var _spec = new PersistenceSpecification<NoParameterlessConstructorClass>(sessionSource);
+ _spec.VerifyTheMappings(new NoParameterlessConstructorClass(123));
+ }
+
public class PublicConstructorClass
{
public PublicConstructorClass() { }
View
6 src/FluentNHibernate/Testing/PersistenceSpecification.cs
@@ -38,9 +38,11 @@ public PersistenceSpecification(ISession session, IEqualityComparer entityEquali
public void VerifyTheMappings()
{
- // CreateProperties the initial copy
- var first = typeof(T).InstantiateUsingParameterlessConstructor<T>();
+ VerifyTheMappings(typeof(T).InstantiateUsingParameterlessConstructor<T>());
+ }
+ public void VerifyTheMappings(T first)
+ {
// Set the "suggested" properties, including references
// to other entities and possibly collections
allProperties.ForEach(p => p.SetValue(first));
Please sign in to comment.
Something went wrong with that request. Please try again.