Index: Ringtoets/Common/test/Ringtoets.Common.Data.Test/IllustrationPoints/SubMechanismIllustrationPointStochastTest.cs
===================================================================
diff -u -rb7988d7a5616c8c305dac4419a15d5eda07e88bc -r49e98fdfafaeeb7e850b9a2ebc13afa0873ebd66
--- Ringtoets/Common/test/Ringtoets.Common.Data.Test/IllustrationPoints/SubMechanismIllustrationPointStochastTest.cs (.../SubMechanismIllustrationPointStochastTest.cs) (revision b7988d7a5616c8c305dac4419a15d5eda07e88bc)
+++ Ringtoets/Common/test/Ringtoets.Common.Data.Test/IllustrationPoints/SubMechanismIllustrationPointStochastTest.cs (.../SubMechanismIllustrationPointStochastTest.cs) (revision 49e98fdfafaeeb7e850b9a2ebc13afa0873ebd66)
@@ -23,6 +23,8 @@
using NUnit.Framework;
using Ringtoets.Common.Data.IllustrationPoints;
using Ringtoets.Common.Data.TestUtil;
+using CoreCloneAssert = Core.Common.Data.TestUtil.CloneAssert;
+using CommonCloneAssert = Ringtoets.Common.Data.TestUtil.CloneAssert;
namespace Ringtoets.Common.Data.Test.IllustrationPoints
{
@@ -53,5 +55,22 @@
stochast.Realization.GetAccuracy());
Assert.AreEqual(5, stochast.Realization.NumberOfDecimalPlaces);
}
+
+ [Test]
+ public void Clone_Always_ReturnNewInstanceWithCopiedValues()
+ {
+ // Setup
+ var random = new Random(21);
+ var original = new SubMechanismIllustrationPointStochast("Random name",
+ random.NextDouble(),
+ random.NextDouble(),
+ random.NextDouble());
+
+ // Call
+ object clone = original.Clone();
+
+ // Assert
+ CoreCloneAssert.AreClones(original, clone, CommonCloneAssert.AreClones);
+ }
}
}
\ No newline at end of file
Index: Ringtoets/Common/test/Ringtoets.Common.Data.TestUtil/CloneAssert.cs
===================================================================
diff -u -r89bc26e38feafeaf46f737e31f359462854390a4 -r49e98fdfafaeeb7e850b9a2ebc13afa0873ebd66
--- Ringtoets/Common/test/Ringtoets.Common.Data.TestUtil/CloneAssert.cs (.../CloneAssert.cs) (revision 89bc26e38feafeaf46f737e31f359462854390a4)
+++ Ringtoets/Common/test/Ringtoets.Common.Data.TestUtil/CloneAssert.cs (.../CloneAssert.cs) (revision 49e98fdfafaeeb7e850b9a2ebc13afa0873ebd66)
@@ -103,5 +103,19 @@
Assert.AreEqual(original.Alpha, clone.Alpha);
Assert.AreEqual(original.Duration, clone.Duration);
}
+
+ ///
+ /// Method that asserts whether and
+ /// are clones.
+ ///
+ /// The original object.
+ /// The cloned object.
+ /// Thrown when and
+ /// are not clones.
+ public static void AreClones(SubMechanismIllustrationPointStochast original, SubMechanismIllustrationPointStochast clone)
+ {
+ AreClones((Stochast) original, clone);
+ Assert.AreEqual(original.Realization, clone.Realization);
+ }
}
}
\ No newline at end of file