Index: Ringtoets/Common/src/Ringtoets.Common.Forms/PresentationObjects/FailureMechanismContext.cs =================================================================== diff -u -r7144ed9829e56a34e064267053216ffbcf6cff52 -rc2ba7fe7272ecdda1b319d1caa18340d6cf219e4 --- Ringtoets/Common/src/Ringtoets.Common.Forms/PresentationObjects/FailureMechanismContext.cs (.../FailureMechanismContext.cs) (revision 7144ed9829e56a34e064267053216ffbcf6cff52) +++ Ringtoets/Common/src/Ringtoets.Common.Forms/PresentationObjects/FailureMechanismContext.cs (.../FailureMechanismContext.cs) (revision c2ba7fe7272ecdda1b319d1caa18340d6cf219e4) @@ -20,6 +20,7 @@ // All rights reserved. using System; +using System.Collections.Generic; using Ringtoets.Common.Data; namespace Ringtoets.Common.Forms.PresentationObjects @@ -43,6 +44,16 @@ Parent = parent; } + /// + /// Gets the parent of . + /// + public AssessmentSectionBase Parent { get; private set; } + + /// + /// Gets the wrapped failure mechanism. + /// + public T WrappedData { get; private set; } + private void AssertInputsAreNotNull(T wrappedFailureMechanism, AssessmentSectionBase parent) { if (wrappedFailureMechanism == null) @@ -56,14 +67,35 @@ } } - /// - /// Gets the parent of . - /// - public AssessmentSectionBase Parent { get; private set; } + #region Equals implementation - /// - /// Gets the wrapped failure mechanism. - /// - public T WrappedData { get; private set; } + public override bool Equals(object obj) + { + if (ReferenceEquals(null, obj)) + { + return false; + } + if (ReferenceEquals(this, obj)) + { + return true; + } + if (obj.GetType() != GetType()) + { + return false; + } + return Equals((FailureMechanismContext) obj); + } + + public override int GetHashCode() + { + return EqualityComparer.Default.GetHashCode(WrappedData); + } + + private bool Equals(FailureMechanismContext other) + { + return EqualityComparer.Default.Equals(WrappedData, other.WrappedData); + } + + #endregion } } \ No newline at end of file