Arrays of reference types can now be cloned, too - deep expression tree cloner is finished!

git-svn-id: file:///srv/devel/repo-conversion/nusu@240 d2e56fa2-650e-0410-a79f-9358c0239efd
This commit is contained in:
Markus Ewald 2012-02-08 11:12:44 +00:00
parent e57140579c
commit e7d1c9720b
2 changed files with 36 additions and 39 deletions

View file

@ -77,6 +77,7 @@ namespace Nuclex.Support.Cloning {
Assert.AreSame(original[0], clone[0]);
}
#endif
/// <summary>Verifies that deep clones of arrays can be made</summary>
[Test]
public void DeepClonesOfArraysCanBeMade() {
@ -87,11 +88,11 @@ namespace Nuclex.Support.Cloning {
};
TestReferenceType[,] clone = this.cloneFactory.DeepClone(original, false);
//Assert.AreNotSame(original[0, 0], clone[0, 0]);
//Assert.AreEqual(original[0,0].TestField, clone[0,0].TestField);
//Assert.AreEqual(original[0,0].TestProperty, clone[0,0].TestProperty);
Assert.AreNotSame(original[0, 0], clone[0, 0]);
Assert.AreEqual(original[0, 0].TestField, clone[0, 0].TestField);
Assert.AreEqual(original[0, 0].TestProperty, clone[0, 0].TestProperty);
}
#if false
/// <summary>Verifies that deep clones of a generic list can be made</summary>
[Test]
public void GenericListsCanBeCloned() {
@ -111,6 +112,7 @@ namespace Nuclex.Support.Cloning {
Assert.AreEqual("one", clone[1]);
}
#if false
/// <summary>
/// Verifies that a field-based shallow clone of a value type can be performed
/// </summary>
@ -138,7 +140,7 @@ namespace Nuclex.Support.Cloning {
public void DeepFieldBasedClonesOfValueTypesCanBeMade() {
HierarchicalValueType original = CreateValueType();
HierarchicalValueType clone = this.cloneFactory.DeepClone(original, false);
//VerifyClone(ref original, ref clone, isDeepClone: true, isPropertyBasedClone: false);
VerifyClone(ref original, ref clone, isDeepClone: true, isPropertyBasedClone: false);
}
/// <summary>
@ -148,7 +150,7 @@ namespace Nuclex.Support.Cloning {
public void DeepFieldBasedClonesOfReferenceTypesCanBeMade() {
HierarchicalReferenceType original = CreateReferenceType();
HierarchicalReferenceType clone = this.cloneFactory.DeepClone(original, false);
//VerifyClone(original, clone, isDeepClone: true, isPropertyBasedClone: false);
VerifyClone(original, clone, isDeepClone: true, isPropertyBasedClone: false);
}
#if false
@ -171,7 +173,9 @@ namespace Nuclex.Support.Cloning {
HierarchicalReferenceType clone = this.cloneFactory.ShallowClone(original, true);
VerifyClone(original, clone, isDeepClone: false, isPropertyBasedClone: true);
}
#endif
#if false
/// <summary>
/// Verifies that a property-based deep clone of a value type can be performed
/// </summary>