Index: Ringtoets/Common/test/Ringtoets.Common.Data.Test/Calculation/CalculationGroupTest.cs =================================================================== diff -u -r3178e116f5e59e03078d465efeb303c5e232c7bf -rfb83f35cff901948b621ab14c2064590b33f17a0 --- Ringtoets/Common/test/Ringtoets.Common.Data.Test/Calculation/CalculationGroupTest.cs (.../CalculationGroupTest.cs) (revision 3178e116f5e59e03078d465efeb303c5e232c7bf) +++ Ringtoets/Common/test/Ringtoets.Common.Data.Test/Calculation/CalculationGroupTest.cs (.../CalculationGroupTest.cs) (revision fb83f35cff901948b621ab14c2064590b33f17a0) @@ -21,9 +21,12 @@ using System; using Core.Common.Base; +using Core.Common.Data.TestUtil; +using Core.Common.TestUtil; using NUnit.Framework; using Rhino.Mocks; using Ringtoets.Common.Data.Calculation; +using Ringtoets.Common.Data.TestUtil; namespace Ringtoets.Common.Data.Test.Calculation { @@ -222,5 +225,42 @@ }, group.Children, "Already existing items should have remained in collection and new item should be added."); } + + [Test] + public void Clone_Always_ReturnNewInstanceWithCopiedValues() + { + // Setup + var random = new Random(21); + var original = new CalculationGroup("Random group name", random.NextBoolean()) + { + Children = + { + new TestCalculationBase + { + Name = "Random item name 1" + }, + new TestCalculationBase + { + Name = "Random item name 2" + } + } + }; + + // Call + object clone = original.Clone(); + + // Assert + CoreCloneAssert.AreObjectClones(original, clone, CommonCloneAssert.AreEqual); + } + + private class TestCalculationBase : Observable, ICalculationBase + { + public string Name { get; set; } + + public object Clone() + { + return MemberwiseClone(); + } + } } } \ No newline at end of file