Fixed a bug in the cloners: if a class has properties with only a setter or only a getter, the property-based clones now ignore that property; added a unit test that verifies types without a default constructor can be cloned as well

git-svn-id: file:///srv/devel/repo-conversion/nusu@248 d2e56fa2-650e-0410-a79f-9358c0239efd
This commit is contained in:
Markus Ewald 2012-02-08 19:26:05 +00:00
parent 48e1674912
commit 0290444140
7 changed files with 200 additions and 108 deletions

View file

@ -45,6 +45,19 @@ namespace Nuclex.Support.Cloning {
Assert.IsNull(this.cloneFactory.ShallowPropertyClone<object>(null));
}
/// <summary>
/// Verifies that clones of objects whose class doesn't possess a default constructor
/// can be made
/// </summary>
[Test]
public void ClassWithoutDefaultConstructorCanBeCloned() {
var original = new ClassWithoutDefaultConstructor(1234);
ClassWithoutDefaultConstructor clone = this.cloneFactory.DeepFieldClone(original);
Assert.AreNotSame(original, clone);
Assert.AreEqual(original.Dummy, clone.Dummy);
}
/// <summary>Verifies that clones of primitive types can be created</summary>
[Test]
public void PrimitiveTypesCanBeCloned() {