Permalink
Browse files

Allow VerifyTheMappings to accept an instance.

  • Loading branch information...
1 parent f4b55a5 commit fcdd5b699fd752a83717d4426bdd860ac19ee5dc Barry Dahlberg committed with paulbatum Dec 11, 2009
@@ -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() { }
@@ -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));

0 comments on commit fcdd5b6

Please sign in to comment.