Index: Ringtoets/Common/src/Ringtoets.Common.Forms/PresentationObjects/FailureMechanismContext.cs
===================================================================
diff -u -rc4d2af65ad23757fb3bd11f93458839bc1787ded -r684b8c0ca681ea2da3cc988bd60e9223037e5a16
--- Ringtoets/Common/src/Ringtoets.Common.Forms/PresentationObjects/FailureMechanismContext.cs (.../FailureMechanismContext.cs) (revision c4d2af65ad23757fb3bd11f93458839bc1787ded)
+++ Ringtoets/Common/src/Ringtoets.Common.Forms/PresentationObjects/FailureMechanismContext.cs (.../FailureMechanismContext.cs) (revision 684b8c0ca681ea2da3cc988bd60e9223037e5a16)
@@ -20,6 +20,9 @@
// All rights reserved.
using System;
+
+using Core.Common.Controls.PresentationObjects;
+
using Ringtoets.Common.Data.AssessmentSection;
using Ringtoets.Common.Data.FailureMechanism;
@@ -28,74 +31,32 @@
///
/// This class is a presentation object for a instance.
///
- public abstract class FailureMechanismContext where T : IFailureMechanism
+ public abstract class FailureMechanismContext : WrappedObjectContextBase where T : IFailureMechanism
{
///
/// Initializes a new instance of the class.
///
/// The failure mechanism.
/// The parent of .
/// Thrown when or are null.
- protected FailureMechanismContext(T wrappedFailureMechanism, IAssessmentSection parent)
+ protected FailureMechanismContext(T wrappedFailureMechanism, IAssessmentSection parent) : base(wrappedFailureMechanism)
{
- AssertInputsAreNotNull(wrappedFailureMechanism, parent);
+ AssertInputsAreNotNull(parent);
- WrappedData = wrappedFailureMechanism;
Parent = parent;
}
///
- /// Gets the parent of .
+ /// Gets the parent of .
///
public IAssessmentSection Parent { get; private set; }
- ///
- /// Gets the wrapped failure mechanism.
- ///
- public T WrappedData { get; private set; }
-
- private void AssertInputsAreNotNull(T wrappedFailureMechanism, IAssessmentSection parent)
+ private void AssertInputsAreNotNull(IAssessmentSection parent)
{
- if (wrappedFailureMechanism == null)
- {
- throw new ArgumentNullException("wrappedFailureMechanism", "Failure mechanism cannot be null.");
- }
-
if (parent == null)
{
throw new ArgumentNullException("parent", "The assessment section cannot be null.");
}
}
-
- #region Equals implementation
-
- 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 WrappedData.GetHashCode();
- }
-
- private bool Equals(FailureMechanismContext other)
- {
- return WrappedData.Equals(other.WrappedData);
- }
-
- #endregion
}
}
\ No newline at end of file