Index: Ringtoets/Common/src/Ringtoets.Common.Forms/PresentationObjects/CommentContext.cs =================================================================== diff -u -rfa424689d48793c024e73bfcee1c202559eea3e0 -r14185c4e29bcfc887fa656a681bdde704d250a9f --- Ringtoets/Common/src/Ringtoets.Common.Forms/PresentationObjects/CommentContext.cs (.../CommentContext.cs) (revision fa424689d48793c024e73bfcee1c202559eea3e0) +++ Ringtoets/Common/src/Ringtoets.Common.Forms/PresentationObjects/CommentContext.cs (.../CommentContext.cs) (revision 14185c4e29bcfc887fa656a681bdde704d250a9f) @@ -20,32 +20,21 @@ // All rights reserved. using System; +using Core.Common.Controls.PresentationObjects; using Ringtoets.Common.Data; namespace Ringtoets.Common.Forms.PresentationObjects { /// /// This class is a presentation object for the comment of . /// - public class CommentContext where T : ICommentable + public class CommentContext : WrappedObjectContextBase where T : ICommentable { /// /// Creates a new instance of . /// - /// The container to wrap. - /// Thrown when is null. - public CommentContext(T commentContainer) - { - if (commentContainer == null) - { - throw new ArgumentNullException("commentContainer"); - } - CommentContainer = commentContainer; - } - - /// - /// Gets the wrapped comment container. - /// - public T CommentContainer { get; private set; } + /// The commentable item to wrap. + /// Thrown when is null. + public CommentContext(T wrappedCommentable) : base(wrappedCommentable) {} } -} +} \ No newline at end of file Index: Ringtoets/Common/src/Ringtoets.Common.Forms/PresentationObjects/FailureMechanismContributionContext.cs =================================================================== diff -u -r658bc34e6a72d83b209bf9bdf45d1001ca135e51 -r14185c4e29bcfc887fa656a681bdde704d250a9f --- Ringtoets/Common/src/Ringtoets.Common.Forms/PresentationObjects/FailureMechanismContributionContext.cs (.../FailureMechanismContributionContext.cs) (revision 658bc34e6a72d83b209bf9bdf45d1001ca135e51) +++ Ringtoets/Common/src/Ringtoets.Common.Forms/PresentationObjects/FailureMechanismContributionContext.cs (.../FailureMechanismContributionContext.cs) (revision 14185c4e29bcfc887fa656a681bdde704d250a9f) @@ -35,11 +35,11 @@ /// /// Initializes a new instance of the class. /// - /// The contribution. - /// The parent of . + /// The contribution to wrap. + /// The parent of . /// When any input argument is null. - public FailureMechanismContributionContext(FailureMechanismContribution contribution, IAssessmentSection contributionOwner) - : base(contribution) + public FailureMechanismContributionContext(FailureMechanismContribution wrappedContribution, IAssessmentSection contributionOwner) + : base(wrappedContribution) { AssertInputsAreNotNull(contributionOwner); Index: Ringtoets/Common/src/Ringtoets.Common.Forms/PresentationObjects/FailureMechanismSectionResultContext.cs =================================================================== diff -u -r41fac7fff0a505c08945108d795dcb877f10b816 -r14185c4e29bcfc887fa656a681bdde704d250a9f --- Ringtoets/Common/src/Ringtoets.Common.Forms/PresentationObjects/FailureMechanismSectionResultContext.cs (.../FailureMechanismSectionResultContext.cs) (revision 41fac7fff0a505c08945108d795dcb877f10b816) +++ Ringtoets/Common/src/Ringtoets.Common.Forms/PresentationObjects/FailureMechanismSectionResultContext.cs (.../FailureMechanismSectionResultContext.cs) (revision 14185c4e29bcfc887fa656a681bdde704d250a9f) @@ -21,41 +21,34 @@ using System; using System.Collections.Generic; +using Core.Common.Controls.PresentationObjects; using Ringtoets.Common.Data.FailureMechanism; namespace Ringtoets.Common.Forms.PresentationObjects { /// /// This class is a presentation object for a collection of . /// - public class FailureMechanismSectionResultContext where T : FailureMechanismSectionResult + public class FailureMechanismSectionResultContext : WrappedObjectContextBase> where T : FailureMechanismSectionResult { /// /// Creates a new instance of . /// - /// The of to wrap. - /// The belongs to. - /// Thrown when or is null. - public FailureMechanismSectionResultContext(IEnumerable sectionResults, IFailureMechanism failureMechanism) + /// The of to wrap. + /// The the belongs to. + /// Thrown when or is null. + public FailureMechanismSectionResultContext(IEnumerable wrappedSectionResults, IFailureMechanism failureMechanism) + : base(wrappedSectionResults) { - if (sectionResults == null) - { - throw new ArgumentNullException("sectionResults"); - } if (failureMechanism == null) { throw new ArgumentNullException("failureMechanism"); } - SectionResults = sectionResults; + FailureMechanism = failureMechanism; } /// - /// Gets the wrapped of . - /// - public IEnumerable SectionResults { get; private set; } - - /// /// Gets the . /// public IFailureMechanism FailureMechanism { get; private set; } Index: Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PresentationObjects/CommentContextTest.cs =================================================================== diff -u -r4c21758818f3c1f159de75fec5a3721fe5b50b6a -r14185c4e29bcfc887fa656a681bdde704d250a9f --- Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PresentationObjects/CommentContextTest.cs (.../CommentContextTest.cs) (revision 4c21758818f3c1f159de75fec5a3721fe5b50b6a) +++ Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PresentationObjects/CommentContextTest.cs (.../CommentContextTest.cs) (revision 14185c4e29bcfc887fa656a681bdde704d250a9f) @@ -19,7 +19,7 @@ // Stichting Deltares and remain full property of Stichting Deltares at all times. // All rights reserved. -using System; +using Core.Common.Controls.PresentationObjects; using NUnit.Framework; using Rhino.Mocks; using Ringtoets.Common.Data; @@ -42,20 +42,10 @@ var context = new CommentContext(commentMock); // Assert - Assert.AreSame(commentMock, context.CommentContainer); + Assert.IsInstanceOf>(context); + Assert.AreSame(commentMock, context.WrappedData); mocks.VerifyAll(); } - - [Test] - public void Constructor_CommentContainerNull_ThrowsArgumentNullException() - { - // Call - TestDelegate call = () => new CommentContext(null); - - // Assert - var exception = Assert.Throws(call); - Assert.AreEqual("commentContainer", exception.ParamName); - } } } \ No newline at end of file Index: Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PresentationObjects/FailureMechanismContextTest.cs =================================================================== diff -u -r44568559b13a82c0ed7640ff2d5648552a0d7add -r14185c4e29bcfc887fa656a681bdde704d250a9f --- Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PresentationObjects/FailureMechanismContextTest.cs (.../FailureMechanismContextTest.cs) (revision 44568559b13a82c0ed7640ff2d5648552a0d7add) +++ Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PresentationObjects/FailureMechanismContextTest.cs (.../FailureMechanismContextTest.cs) (revision 14185c4e29bcfc887fa656a681bdde704d250a9f) @@ -53,22 +53,6 @@ } [Test] - public void Constructor_FailureMechanismNull_ThrowsArgumentNullException() - { - // Setup - var mocks = new MockRepository(); - var assessmentSection = mocks.Stub(); - mocks.ReplayAll(); - - // Call - TestDelegate test = () => new SimpleFailureMechanismContext(null, assessmentSection); - - // Assert - var exception = Assert.Throws(test); - Assert.AreEqual("wrappedData", exception.ParamName); - } - - [Test] public void Constructor_AssessmentSectionNull_ThrowsArgumentNullException() { // Setup @@ -84,136 +68,6 @@ Assert.AreEqual("parent", exception.ParamName); } - [Test] - public void Equals_ToItself_ReturnTrue() - { - // Setup - var mocks = new MockRepository(); - var assessmentSection = mocks.StrictMock(); - var failureMechanism = mocks.StrictMock(); - mocks.ReplayAll(); - - var context = new SimpleFailureMechanismContext(failureMechanism, assessmentSection); - - // Call - bool isEqual = context.Equals(context); - - // Assert - Assert.IsTrue(isEqual); - mocks.VerifyAll(); - } - - [Test] - public void Equals_ToNull_ReturnFalse() - { - // Setup - var mocks = new MockRepository(); - var assessmentSection = mocks.StrictMock(); - var failureMechanism = mocks.StrictMock(); - mocks.ReplayAll(); - - var context = new SimpleFailureMechanismContext(failureMechanism, assessmentSection); - - // Call - bool isEqual = context.Equals(null); - - // Assert - Assert.IsFalse(isEqual); - mocks.VerifyAll(); - } - - [Test] - public void Equals_ToEqualOtherInstance_ReturnTrue() - { - // Setup - var mocks = new MockRepository(); - var assessmentSection = mocks.StrictMock(); - var failureMechanism = mocks.StrictMock(); - mocks.ReplayAll(); - - var context = new SimpleFailureMechanismContext(failureMechanism, assessmentSection); - var otherContext = new SimpleFailureMechanismContext(failureMechanism, assessmentSection); - - // Call - bool isEqual = context.Equals(otherContext); - bool isEqual2 = otherContext.Equals(context); - - // Assert - Assert.IsTrue(isEqual); - Assert.IsTrue(isEqual2); - mocks.VerifyAll(); - } - - [Test] - public void Equals_ToInequalOtherFailureMechanismInstance_ReturnFalse() - { - // Setup - var mocks = new MockRepository(); - var assessmentSection = mocks.StrictMock(); - var failureMechanism = mocks.StrictMock(); - var otherFailureMechanism = mocks.StrictMock(); - mocks.ReplayAll(); - - var context = new SimpleFailureMechanismContext(failureMechanism, assessmentSection); - var otherContext = new SimpleFailureMechanismContext(otherFailureMechanism, assessmentSection); - - // Call - bool isEqual = context.Equals(otherContext); - bool isEqual2 = otherContext.Equals(context); - - // Assert - Assert.IsFalse(isEqual); - Assert.IsFalse(isEqual2); - mocks.VerifyAll(); - } - - [Test] - public void Equals_ToOtherTypeInstance_ReturnFalse() - { - // Setup - var mocks = new MockRepository(); - var assessmentSection = mocks.StrictMock(); - var failureMechanism = mocks.StrictMock(); - mocks.ReplayAll(); - - var context = new SimpleFailureMechanismContext(failureMechanism, assessmentSection); - var otherObject = new object(); - - // Call - bool isEqual = context.Equals(otherObject); - bool isEqual2 = otherObject.Equals(context); - - // Assert - Assert.IsFalse(isEqual); - Assert.IsFalse(isEqual2); - mocks.VerifyAll(); - } - - [Test] - public void GetHashCode_TwoContextInstancesEqualToEachOther_ReturnIdenticalHashes() - { - // Setup - var mocks = new MockRepository(); - var assessmentSection = mocks.StrictMock(); - var failureMechanism = mocks.StrictMock(); - mocks.ReplayAll(); - - var context = new SimpleFailureMechanismContext(failureMechanism, assessmentSection); - - var otherContext = new SimpleFailureMechanismContext(failureMechanism, assessmentSection); - - // Precondition - Assert.True(context.Equals(otherContext)); - - // Call - int contextHashCode = context.GetHashCode(); - int otherContextHashCode = otherContext.GetHashCode(); - - // Assert - Assert.AreEqual(contextHashCode, otherContextHashCode); - mocks.VerifyAll(); - } - private class SimpleFailureMechanismContext : FailureMechanismContext { public SimpleFailureMechanismContext(IFailureMechanism wrappedFailureMechanism, IAssessmentSection parent) : base(wrappedFailureMechanism, parent) {} Index: Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PresentationObjects/FailureMechanismContributionContextTest.cs =================================================================== diff -u -r33bb120fbaf0452934a7762b24d675201325e774 -r14185c4e29bcfc887fa656a681bdde704d250a9f --- Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PresentationObjects/FailureMechanismContributionContextTest.cs (.../FailureMechanismContributionContextTest.cs) (revision 33bb120fbaf0452934a7762b24d675201325e774) +++ Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PresentationObjects/FailureMechanismContributionContextTest.cs (.../FailureMechanismContributionContextTest.cs) (revision 14185c4e29bcfc887fa656a681bdde704d250a9f) @@ -21,7 +21,6 @@ using System; using System.Linq; -using Core.Common.Base; using Core.Common.Controls.PresentationObjects; using Core.Common.TestUtil; using NUnit.Framework; @@ -52,29 +51,12 @@ // Assert Assert.IsInstanceOf>(context); - Assert.IsInstanceOf(context); Assert.AreSame(contribution, context.WrappedData); Assert.AreSame(assessmentSection, context.Parent); mocks.VerifyAll(); } [Test] - public void Contructor_FailureMechanismContributionIsNull_ThrowArgumentNullException() - { - // Setup - var mocks = new MockRepository(); - IAssessmentSection assessmentSection = mocks.Stub(); - mocks.ReplayAll(); - - // Call - TestDelegate call = () => new FailureMechanismContributionContext(null, assessmentSection); - - // Assert - TestHelper.AssertThrowsArgumentExceptionAndTestMessage(call, "Wrapped data of context cannot be null."); - mocks.VerifyAll(); - } - - [Test] public void Contructor_AssessmentSectionIsNull_ThrowArgumentNullException() { // Setup @@ -87,212 +69,5 @@ // Assert TestHelper.AssertThrowsArgumentExceptionAndTestMessage(call, "Assessment section cannot be null."); } - - [Test] - public void Equals_ToNull_ReturnFalse() - { - // Setup - var failureMechanisms = Enumerable.Empty(); - var contribution = new FailureMechanismContribution(failureMechanisms, 1.1, 30000); - - var mocks = new MockRepository(); - IAssessmentSection assessmentSection = mocks.Stub(); - mocks.ReplayAll(); - - var context = new FailureMechanismContributionContext(contribution, assessmentSection); - - // Call - bool isEqual = context.Equals(null); - - // Assert - Assert.IsFalse(isEqual); - } - - [Test] - public void Equals_ToDifferentObjectType_ReturnFalse() - { - // Setup - var failureMechanisms = Enumerable.Empty(); - var contribution = new FailureMechanismContribution(failureMechanisms, 1.1, 30000); - - var mocks = new MockRepository(); - IAssessmentSection assessmentSection = mocks.Stub(); - mocks.ReplayAll(); - - var context = new FailureMechanismContributionContext(contribution, assessmentSection); - object differentObject = new object(); - - // Call - bool isEqual1 = context.Equals(differentObject); - bool isEqual2 = differentObject.Equals(context); - - // Assert - Assert.IsFalse(isEqual1); - Assert.IsFalse(isEqual2); - } - - [Test] - public void Equals_ToEqualObject_ReturnTrue() - { - // Setup - var failureMechanisms = Enumerable.Empty(); - var contribution = new FailureMechanismContribution(failureMechanisms, 1.1, 30000); - - var mocks = new MockRepository(); - IAssessmentSection assessmentSection = mocks.Stub(); - mocks.ReplayAll(); - - var context1 = new FailureMechanismContributionContext(contribution, assessmentSection); - object context2 = new FailureMechanismContributionContext(contribution, assessmentSection); - - // Call - bool isEqual1 = context1.Equals(context2); - bool isEqual2 = context2.Equals(context1); - - // Assert - Assert.IsTrue(isEqual1); - Assert.IsTrue(isEqual2); - } - - [Test] - public void Equals_ToInequalObject_ReturnFalse() - { - // Setup - var failureMechanisms = Enumerable.Empty(); - var contribution1 = new FailureMechanismContribution(failureMechanisms, 1.1, 30000); - var contribution2 = new FailureMechanismContribution(failureMechanisms, 2.2, 40000); - - var mocks = new MockRepository(); - IAssessmentSection assessmentSection = mocks.Stub(); - mocks.ReplayAll(); - - var context1 = new FailureMechanismContributionContext(contribution1, assessmentSection); - var context2 = new FailureMechanismContributionContext(contribution2, assessmentSection); - - // Precondition - Assert.IsFalse(contribution1.Equals(contribution2)); - - // Call - bool isEqual1 = context1.Equals(context2); - bool isEqual2 = context2.Equals(context1); - - // Assert - Assert.IsFalse(isEqual1); - Assert.IsFalse(isEqual2); - } - - [Test] - public void GetHashCode_ComparingEqualObject_ReturnEqualHashCodes() - { - // Setup - var failureMechanisms = Enumerable.Empty(); - var contribution = new FailureMechanismContribution(failureMechanisms, 1.1, 30000); - - var mocks = new MockRepository(); - IAssessmentSection assessmentSection = mocks.Stub(); - mocks.ReplayAll(); - - var context1 = new FailureMechanismContributionContext(contribution, assessmentSection); - var context2 = new FailureMechanismContributionContext(contribution, assessmentSection); - - // Call - int hash1 = context1.GetHashCode(); - int hash2 = context2.GetHashCode(); - - // Assert - Assert.AreEqual(hash1, hash2); - } - - [Test] - public void NotifyObservers_WithAttachedObserver_UpdateObserverCalled() - { - // Setup - var mocks = new MockRepository(); - var assessmentSection = mocks.Stub(); - - var observer = mocks.StrictMock(); - observer.Expect(o => o.UpdateObserver()); - mocks.ReplayAll(); - - var contribution = new FailureMechanismContribution(Enumerable.Empty(), 100.0, 30000); - - var context = new FailureMechanismContributionContext(contribution, assessmentSection); - context.Attach(observer); - - // Call - context.NotifyObservers(); - - // Assert - mocks.VerifyAll(); // Expect UpdateObserver called - } - - [Test] - public void NotifyObservers_WithDetachedObserver_NoUpdateObserverCalled() - { - // Setup - var mocks = new MockRepository(); - var assessmentSection = mocks.Stub(); - - var observer = mocks.StrictMock(); - mocks.ReplayAll(); - - var contribution = new FailureMechanismContribution(Enumerable.Empty(), 100.0, 30000); - - var context = new FailureMechanismContributionContext(contribution, assessmentSection); - context.Attach(observer); - context.Detach(observer); - - // Call - context.NotifyObservers(); - - // Assert - mocks.VerifyAll(); // Expect no UpdateObserver call - } - - [Test] - public void NotifyObservers_WithAttachedObserverToContribution_UpdateObserverCalled() - { - // Setup - var mocks = new MockRepository(); - var assessmentSection = mocks.Stub(); - - var observer = mocks.StrictMock(); - observer.Expect(o => o.UpdateObserver()); - mocks.ReplayAll(); - - var contribution = new FailureMechanismContribution(Enumerable.Empty(), 100.0, 30000); - contribution.Attach(observer); - - var context = new FailureMechanismContributionContext(contribution, assessmentSection); - - // Call - context.NotifyObservers(); - - // Assert - mocks.VerifyAll(); // Expect UpdateObserver called - } - - [Test] - public void GivenObserverAttachedToContext_WhenWrappedDataNotifiesObservers_ThenUpdateObserverCalled() - { - // Given - var mocks = new MockRepository(); - var assessmentSection = mocks.Stub(); - - var observer = mocks.StrictMock(); - observer.Expect(o => o.UpdateObserver()); - mocks.ReplayAll(); - - var contribution = new FailureMechanismContribution(Enumerable.Empty(), 100.0, 30000); - - var context = new FailureMechanismContributionContext(contribution, assessmentSection); - context.Attach(observer); - - // When - contribution.NotifyObservers(); - - // Then - mocks.VerifyAll(); // Expect no UpdateObserver call - } } } \ No newline at end of file Index: Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PresentationObjects/FailureMechanismSectionResultContextTest.cs =================================================================== diff -u -r507e30ebf13ba63fcedbe9a5b8457f302da26429 -r14185c4e29bcfc887fa656a681bdde704d250a9f --- Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PresentationObjects/FailureMechanismSectionResultContextTest.cs (.../FailureMechanismSectionResultContextTest.cs) (revision 507e30ebf13ba63fcedbe9a5b8457f302da26429) +++ Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PresentationObjects/FailureMechanismSectionResultContextTest.cs (.../FailureMechanismSectionResultContextTest.cs) (revision 14185c4e29bcfc887fa656a681bdde704d250a9f) @@ -20,7 +20,9 @@ // All rights reserved. using System; +using System.Collections.Generic; using Core.Common.Base.Geometry; +using Core.Common.Controls.PresentationObjects; using NUnit.Framework; using Rhino.Mocks; using Ringtoets.Common.Data.FailureMechanism; @@ -38,45 +40,24 @@ // Setup var mocks = new MockRepository(); var failureMechanismMock = mocks.StrictMock(); + var failureMechanismSectionResults = new[] + { + CreateFailureMechanismSectionResult() + }; - var sectionResult = CreateFailureMechanismSectionResult(); - mocks.ReplayAll(); // Call - var context = new FailureMechanismSectionResultContext(new [] - { - sectionResult - }, failureMechanismMock); + var context = new FailureMechanismSectionResultContext(failureMechanismSectionResults, failureMechanismMock); // Assert - CollectionAssert.AreEqual(new[] - { - sectionResult - }, context.SectionResults); + Assert.IsInstanceOf>>(context); + Assert.AreSame(failureMechanismSectionResults, context.WrappedData); Assert.AreSame(failureMechanismMock, context.FailureMechanism); mocks.VerifyAll(); } [Test] - public void Constructor_FailureMechanismSectionResultListNull_ThrowsArgumentNullException() - { - // Setup - var mocks = new MockRepository(); - var failureMechanismMock = mocks.StrictMock(); - - mocks.ReplayAll(); - - // Call - TestDelegate call = () => new FailureMechanismSectionResultContext(null, failureMechanismMock); - - // Assert - var exception = Assert.Throws(call); - Assert.AreEqual("sectionResults", exception.ParamName); - mocks.VerifyAll(); - } - - [Test] public void Constructor_FailureMechanismNull_ThrowsArgumentNullException() { // Setup Index: Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Plugin/GrassCoverErosionInwardsGuiPlugin.cs =================================================================== diff -u -r006d96ecb9e7d838d7682912270c7d43e0ad67e1 -r14185c4e29bcfc887fa656a681bdde704d250a9f --- Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Plugin/GrassCoverErosionInwardsGuiPlugin.cs (.../GrassCoverErosionInwardsGuiPlugin.cs) (revision 006d96ecb9e7d838d7682912270c7d43e0ad67e1) +++ Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Plugin/GrassCoverErosionInwardsGuiPlugin.cs (.../GrassCoverErosionInwardsGuiPlugin.cs) (revision 14185c4e29bcfc887fa656a681bdde704d250a9f) @@ -75,7 +75,7 @@ GetViewName = (v, o) => RingtoetsCommonDataResources.FailureMechanism_AssessmentResult_DisplayName, Image = RingtoetsCommonFormsResources.FailureMechanismSectionResultIcon, CloseForData = CloseFailureMechanismResultViewForData, - GetViewData = context => context.SectionResults, + GetViewData = context => context.WrappedData, AfterCreate = (view, context) => view.FailureMechanism = context.FailureMechanism }; } Index: Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/PresentationObjects/GrassCoverErosionInwardsFailureMechanismContextTest.cs =================================================================== diff -u -r56c2e743ca139b2b0ff3ecda1420bff7b0049784 -r14185c4e29bcfc887fa656a681bdde704d250a9f --- Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/PresentationObjects/GrassCoverErosionInwardsFailureMechanismContextTest.cs (.../GrassCoverErosionInwardsFailureMechanismContextTest.cs) (revision 56c2e743ca139b2b0ff3ecda1420bff7b0049784) +++ Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/PresentationObjects/GrassCoverErosionInwardsFailureMechanismContextTest.cs (.../GrassCoverErosionInwardsFailureMechanismContextTest.cs) (revision 14185c4e29bcfc887fa656a681bdde704d250a9f) @@ -53,22 +53,6 @@ } [Test] - public void Constructor_FailureMechanismIsNull_ThrowsArgumentNullException() - { - // Setup - var mocks = new MockRepository(); - var assessmentSection = mocks.Stub(); - mocks.ReplayAll(); - - // Call - TestDelegate call = () => new GrassCoverErosionInwardsFailureMechanismContext(null, assessmentSection); - - // Assert - Assert.Throws(call); - mocks.VerifyAll(); - } - - [Test] public void Constructor_AssessmentSectionIsNull_ThrowsArgumentNullException() { // Setup Index: Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/TreeNodeInfos/GrassCoverErosionInwardsCalculationContextTreeNodeInfoTest.cs =================================================================== diff -u -r0e8590d1ba6edc87a2ac73240662bfcf45f20914 -r14185c4e29bcfc887fa656a681bdde704d250a9f --- Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/TreeNodeInfos/GrassCoverErosionInwardsCalculationContextTreeNodeInfoTest.cs (.../GrassCoverErosionInwardsCalculationContextTreeNodeInfoTest.cs) (revision 0e8590d1ba6edc87a2ac73240662bfcf45f20914) +++ Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/TreeNodeInfos/GrassCoverErosionInwardsCalculationContextTreeNodeInfoTest.cs (.../GrassCoverErosionInwardsCalculationContextTreeNodeInfoTest.cs) (revision 14185c4e29bcfc887fa656a681bdde704d250a9f) @@ -120,7 +120,7 @@ var commentContext = children[0] as CommentContext; Assert.IsNotNull(commentContext); - Assert.AreSame(calculationContext.WrappedData, commentContext.CommentContainer); + Assert.AreSame(calculationContext.WrappedData, commentContext.WrappedData); var grassCoverErosionInwardsInputContext = children[1] as GrassCoverErosionInwardsInputContext; Assert.IsNotNull(grassCoverErosionInwardsInputContext); @@ -153,7 +153,7 @@ var commentContext = children[0] as CommentContext; Assert.IsNotNull(commentContext); - Assert.AreSame(calculationContext.WrappedData, commentContext.CommentContainer); + Assert.AreSame(calculationContext.WrappedData, commentContext.WrappedData); var grassCoverErosionInwardsInputContext = children[1] as GrassCoverErosionInwardsInputContext; Assert.IsNotNull(grassCoverErosionInwardsInputContext); Index: Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/TreeNodeInfos/GrassCoverErosionInwardsFailureMechanismContextTreeNodeInfoTest.cs =================================================================== diff -u -r0e8590d1ba6edc87a2ac73240662bfcf45f20914 -r14185c4e29bcfc887fa656a681bdde704d250a9f --- Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/TreeNodeInfos/GrassCoverErosionInwardsFailureMechanismContextTreeNodeInfoTest.cs (.../GrassCoverErosionInwardsFailureMechanismContextTreeNodeInfoTest.cs) (revision 0e8590d1ba6edc87a2ac73240662bfcf45f20914) +++ Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/TreeNodeInfos/GrassCoverErosionInwardsFailureMechanismContextTreeNodeInfoTest.cs (.../GrassCoverErosionInwardsFailureMechanismContextTreeNodeInfoTest.cs) (revision 14185c4e29bcfc887fa656a681bdde704d250a9f) @@ -116,7 +116,7 @@ Assert.AreSame(failureMechanism, failureMechanismSectionsContext.ParentFailureMechanism); Assert.AreSame(assessmentSectionMock, failureMechanismSectionsContext.ParentAssessmentSection); var commentContext = (CommentContext) inputsFolder.Contents[1]; - Assert.AreSame(failureMechanism, commentContext.CommentContainer); + Assert.AreSame(failureMechanism, commentContext.WrappedData); var calculationsFolder = (GrassCoverErosionInwardsCalculationGroupContext) children[1]; Assert.AreEqual("Berekeningen", calculationsFolder.WrappedData.Name); @@ -128,7 +128,7 @@ Assert.AreEqual(TreeFolderCategory.Output, outputsFolder.Category); var failureMechanismResultsContext = (FailureMechanismSectionResultContext) outputsFolder.Contents[0]; Assert.AreSame(failureMechanism, failureMechanismResultsContext.FailureMechanism); - Assert.AreSame(failureMechanism.SectionResults, failureMechanismResultsContext.SectionResults); + Assert.AreSame(failureMechanism.SectionResults, failureMechanismResultsContext.WrappedData); mocksRepository.VerifyAll(); } @@ -152,7 +152,7 @@ // Assert Assert.AreEqual(1, children.Length); var commentContext = (CommentContext) children[0]; - Assert.AreSame(failureMechanism, commentContext.CommentContainer); + Assert.AreSame(failureMechanism, commentContext.WrappedData); mocksRepository.VerifyAll(); } Index: Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.Plugin/HeightStructuresGuiPlugin.cs =================================================================== diff -u -r5a36c286d8fba3ece9cf48061c66958a1feaa33e -r14185c4e29bcfc887fa656a681bdde704d250a9f --- Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.Plugin/HeightStructuresGuiPlugin.cs (.../HeightStructuresGuiPlugin.cs) (revision 5a36c286d8fba3ece9cf48061c66958a1feaa33e) +++ Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.Plugin/HeightStructuresGuiPlugin.cs (.../HeightStructuresGuiPlugin.cs) (revision 14185c4e29bcfc887fa656a681bdde704d250a9f) @@ -75,7 +75,7 @@ GetViewName = (v, o) => RingtoetsCommonDataResources.FailureMechanism_AssessmentResult_DisplayName, Image = RingtoetsCommonFormsResources.FailureMechanismSectionResultIcon, CloseForData = CloseFailureMechanismResultViewForData, - GetViewData = context => context.SectionResults, + GetViewData = context => context.WrappedData, AfterCreate = (view, context) => view.FailureMechanism = context.FailureMechanism }; } Index: Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Forms.Test/PresentationObjects/HeightStructuresFailureMechanismContextTest.cs =================================================================== diff -u -r4936ea40e490dd8a3ed500e1c5a8f8390ff31491 -r14185c4e29bcfc887fa656a681bdde704d250a9f --- Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Forms.Test/PresentationObjects/HeightStructuresFailureMechanismContextTest.cs (.../HeightStructuresFailureMechanismContextTest.cs) (revision 4936ea40e490dd8a3ed500e1c5a8f8390ff31491) +++ Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Forms.Test/PresentationObjects/HeightStructuresFailureMechanismContextTest.cs (.../HeightStructuresFailureMechanismContextTest.cs) (revision 14185c4e29bcfc887fa656a681bdde704d250a9f) @@ -53,23 +53,6 @@ } [Test] - public void Constructor_FailureMechanismIsNull_ThrowArgumentNullException() - { - // Setup - var mocks = new MockRepository(); - var assessmentSection = mocks.Stub(); - mocks.ReplayAll(); - - // Call - TestDelegate call = () => new HeightStructuresFailureMechanismContext(null, assessmentSection); - - // Assert - var exception = Assert.Throws(call); - Assert.AreEqual("wrappedData", exception.ParamName); - mocks.VerifyAll(); - } - - [Test] public void Constructor_AssessmentSectionIsNull_ThrowArgumentNullException() { // Setup Index: Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Forms.Test/TreeNodeInfos/HeightStructuresCalculationContextTreeNodeInfoTest.cs =================================================================== diff -u -rea180de6e9f5ba1108b4ff3cf7bb7e57de72a37a -r14185c4e29bcfc887fa656a681bdde704d250a9f --- Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Forms.Test/TreeNodeInfos/HeightStructuresCalculationContextTreeNodeInfoTest.cs (.../HeightStructuresCalculationContextTreeNodeInfoTest.cs) (revision ea180de6e9f5ba1108b4ff3cf7bb7e57de72a37a) +++ Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Forms.Test/TreeNodeInfos/HeightStructuresCalculationContextTreeNodeInfoTest.cs (.../HeightStructuresCalculationContextTreeNodeInfoTest.cs) (revision 14185c4e29bcfc887fa656a681bdde704d250a9f) @@ -120,7 +120,7 @@ var commentContext = children[0] as CommentContext; Assert.IsNotNull(commentContext); - Assert.AreSame(calculationContext.WrappedData, commentContext.CommentContainer); + Assert.AreSame(calculationContext.WrappedData, commentContext.WrappedData); var heightStructuresInputContext = children[1] as HeightStructuresInputContext; Assert.IsNotNull(heightStructuresInputContext); @@ -154,7 +154,7 @@ var commentContext = children[0] as CommentContext; Assert.IsNotNull(commentContext); - Assert.AreSame(calculationContext.WrappedData, commentContext.CommentContainer); + Assert.AreSame(calculationContext.WrappedData, commentContext.WrappedData); var heightStructuresInputContext = children[1] as HeightStructuresInputContext; Assert.IsNotNull(heightStructuresInputContext); Index: Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Forms.Test/TreeNodeInfos/HeightStructuresFailureMechanismContextTreeNodeInfoTest.cs =================================================================== diff -u -rea180de6e9f5ba1108b4ff3cf7bb7e57de72a37a -r14185c4e29bcfc887fa656a681bdde704d250a9f --- Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Forms.Test/TreeNodeInfos/HeightStructuresFailureMechanismContextTreeNodeInfoTest.cs (.../HeightStructuresFailureMechanismContextTreeNodeInfoTest.cs) (revision ea180de6e9f5ba1108b4ff3cf7bb7e57de72a37a) +++ Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Forms.Test/TreeNodeInfos/HeightStructuresFailureMechanismContextTreeNodeInfoTest.cs (.../HeightStructuresFailureMechanismContextTreeNodeInfoTest.cs) (revision 14185c4e29bcfc887fa656a681bdde704d250a9f) @@ -116,7 +116,7 @@ Assert.AreSame(failureMechanism, failureMechanismSectionsContext.ParentFailureMechanism); Assert.AreSame(assessmentSectionMock, failureMechanismSectionsContext.ParentAssessmentSection); var commentContext = (CommentContext) inputsFolder.Contents[1]; - Assert.AreSame(failureMechanism, commentContext.CommentContainer); + Assert.AreSame(failureMechanism, commentContext.WrappedData); var calculationsFolder = (HeightStructuresCalculationGroupContext) children[1]; Assert.AreEqual("Berekeningen", calculationsFolder.WrappedData.Name); @@ -128,7 +128,7 @@ Assert.AreEqual(TreeFolderCategory.Output, outputsFolder.Category); var failureMechanismResultsContext = (FailureMechanismSectionResultContext) outputsFolder.Contents[0]; Assert.AreSame(failureMechanism, failureMechanismResultsContext.FailureMechanism); - Assert.AreSame(failureMechanism.SectionResults, failureMechanismResultsContext.SectionResults); + Assert.AreSame(failureMechanism.SectionResults, failureMechanismResultsContext.WrappedData); mocksRepository.VerifyAll(); } @@ -152,7 +152,7 @@ // Assert Assert.AreEqual(1, children.Length); var commentContext = (CommentContext) children[0]; - Assert.AreSame(failureMechanism, commentContext.CommentContainer); + Assert.AreSame(failureMechanism, commentContext.WrappedData); mocksRepository.VerifyAll(); } Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/PropertyClasses/StandAloneFailureMechanismContextProperties.cs =================================================================== diff -u -r8c78853745e5865dad910b2d9050ac52585daa87 -r14185c4e29bcfc887fa656a681bdde704d250a9f --- Ringtoets/Integration/src/Ringtoets.Integration.Forms/PropertyClasses/StandAloneFailureMechanismContextProperties.cs (.../StandAloneFailureMechanismContextProperties.cs) (revision 8c78853745e5865dad910b2d9050ac52585daa87) +++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/PropertyClasses/StandAloneFailureMechanismContextProperties.cs (.../StandAloneFailureMechanismContextProperties.cs) (revision 14185c4e29bcfc887fa656a681bdde704d250a9f) @@ -24,12 +24,11 @@ using Core.Common.Utils.Attributes; using Ringtoets.Common.Data.FailureMechanism; using Ringtoets.Common.Forms.PresentationObjects; -using Ringtoets.Integration.Forms.PresentationObjects; namespace Ringtoets.Integration.Forms.PropertyClasses { /// - /// ViewModel of properties panel. + /// ViewModel of properties panel. /// public class StandAloneFailureMechanismContextProperties : ObjectProperties> { Index: Ringtoets/Integration/src/Ringtoets.Integration.Plugin/RingtoetsGuiPlugin.cs =================================================================== diff -u -rdfad022e552dd79f31949b367c99d29b93c4f1e6 -r14185c4e29bcfc887fa656a681bdde704d250a9f --- Ringtoets/Integration/src/Ringtoets.Integration.Plugin/RingtoetsGuiPlugin.cs (.../RingtoetsGuiPlugin.cs) (revision dfad022e552dd79f31949b367c99d29b93c4f1e6) +++ Ringtoets/Integration/src/Ringtoets.Integration.Plugin/RingtoetsGuiPlugin.cs (.../RingtoetsGuiPlugin.cs) (revision 14185c4e29bcfc887fa656a681bdde704d250a9f) @@ -190,7 +190,7 @@ yield return new ViewInfo, ICommentable, CommentView> { GetViewName = (v, o) => Resources.Comment_DisplayName, - GetViewData = context => context.CommentContainer, + GetViewData = context => context.WrappedData, Image = RingtoetsCommonFormsResources.EditDocumentIcon, CloseForData = CloseCommentViewForData }; @@ -209,7 +209,7 @@ GetViewName = (v, o) => RingtoetsCommonDataResources.FailureMechanism_AssessmentResult_DisplayName, Image = RingtoetsCommonFormsResources.FailureMechanismSectionResultIcon, CloseForData = CloseFailureMechanismResultViewForData, - GetViewData = context => context.SectionResults, + GetViewData = context => context.WrappedData, AfterCreate = (view, context) => view.FailureMechanism = context.FailureMechanism }; } Index: Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/TreeNodeInfos/AssessmentSectionTreeNodeInfoTest.cs =================================================================== diff -u -rdfad022e552dd79f31949b367c99d29b93c4f1e6 -r14185c4e29bcfc887fa656a681bdde704d250a9f --- Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/TreeNodeInfos/AssessmentSectionTreeNodeInfoTest.cs (.../AssessmentSectionTreeNodeInfoTest.cs) (revision dfad022e552dd79f31949b367c99d29b93c4f1e6) +++ Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/TreeNodeInfos/AssessmentSectionTreeNodeInfoTest.cs (.../AssessmentSectionTreeNodeInfoTest.cs) (revision 14185c4e29bcfc887fa656a681bdde704d250a9f) @@ -195,7 +195,7 @@ Assert.AreSame(assessmentSection, context.Parent); var commentContext = (CommentContext) objects[3]; - Assert.AreSame(assessmentSection, commentContext.CommentContainer); + Assert.AreSame(assessmentSection, commentContext.WrappedData); var pipingFailureMechanismContext = (PipingFailureMechanismContext) objects[4]; Assert.AreSame(failureMechanisms[0], pipingFailureMechanismContext.WrappedData); Index: Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/TreeNodeInfos/FailureMechanismContextTreeNodeInfoTest.cs =================================================================== diff -u -rdfad022e552dd79f31949b367c99d29b93c4f1e6 -r14185c4e29bcfc887fa656a681bdde704d250a9f --- Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/TreeNodeInfos/FailureMechanismContextTreeNodeInfoTest.cs (.../FailureMechanismContextTreeNodeInfoTest.cs) (revision dfad022e552dd79f31949b367c99d29b93c4f1e6) +++ Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/TreeNodeInfos/FailureMechanismContextTreeNodeInfoTest.cs (.../FailureMechanismContextTreeNodeInfoTest.cs) (revision 14185c4e29bcfc887fa656a681bdde704d250a9f) @@ -175,7 +175,7 @@ var commentContext = (CommentContext) inputFolder.Contents[1]; Assert.IsNotNull(commentContext); - Assert.AreSame(failureMechanism, commentContext.CommentContainer); + Assert.AreSame(failureMechanism, commentContext.WrappedData); var outputFolder = (CategoryTreeFolder) children[1]; Assert.AreEqual("Uitvoer", outputFolder.Name); @@ -233,7 +233,7 @@ var failureMechanismResultsContext = (FailureMechanismSectionResultContext)outputFolder.Contents[0]; Assert.AreSame(failureMechanism, failureMechanismResultsContext.FailureMechanism); - Assert.AreSame(failureMechanism.SectionResults, failureMechanismResultsContext.SectionResults); + Assert.AreSame(failureMechanism.SectionResults, failureMechanismResultsContext.WrappedData); } } @@ -265,7 +265,7 @@ // Assert Assert.AreEqual(1, children.Length); var commentContext = (CommentContext) children[0]; - Assert.AreSame(failureMechanism, commentContext.CommentContainer); + Assert.AreSame(failureMechanism, commentContext.WrappedData); } mocks.VerifyAll(); } Index: Ringtoets/Piping/src/Ringtoets.Piping.Forms/PresentationObjects/PipingFailureMechanismContext.cs =================================================================== diff -u -rc4d2af65ad23757fb3bd11f93458839bc1787ded -r14185c4e29bcfc887fa656a681bdde704d250a9f --- Ringtoets/Piping/src/Ringtoets.Piping.Forms/PresentationObjects/PipingFailureMechanismContext.cs (.../PipingFailureMechanismContext.cs) (revision c4d2af65ad23757fb3bd11f93458839bc1787ded) +++ Ringtoets/Piping/src/Ringtoets.Piping.Forms/PresentationObjects/PipingFailureMechanismContext.cs (.../PipingFailureMechanismContext.cs) (revision 14185c4e29bcfc887fa656a681bdde704d250a9f) @@ -38,9 +38,6 @@ /// The parent of . /// Thrown when or are null. public PipingFailureMechanismContext(PipingFailureMechanism failureMechanism, IAssessmentSection assessmentSection) : - base(failureMechanism, assessmentSection) - { - - } + base(failureMechanism, assessmentSection) {} } } \ No newline at end of file Index: Ringtoets/Piping/src/Ringtoets.Piping.Plugin/PipingGuiPlugin.cs =================================================================== diff -u -r14de3deecd2cff7f6abe41ed6dc5dc016c4c81e0 -r14185c4e29bcfc887fa656a681bdde704d250a9f --- Ringtoets/Piping/src/Ringtoets.Piping.Plugin/PipingGuiPlugin.cs (.../PipingGuiPlugin.cs) (revision 14de3deecd2cff7f6abe41ed6dc5dc016c4c81e0) +++ Ringtoets/Piping/src/Ringtoets.Piping.Plugin/PipingGuiPlugin.cs (.../PipingGuiPlugin.cs) (revision 14185c4e29bcfc887fa656a681bdde704d250a9f) @@ -91,7 +91,7 @@ GetViewName = (v, o) => RingtoetsCommonDataResources.FailureMechanism_AssessmentResult_DisplayName, Image = RingtoetsCommonFormsResources.FailureMechanismSectionResultIcon, CloseForData = CloseFailureMechanismResultViewForData, - GetViewData = context => context.SectionResults, + GetViewData = context => context.WrappedData, AfterCreate = (view, context) => view.FailureMechanism = context.FailureMechanism }; Index: Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/PresentationObjects/PipingCalculationGroupContextTest.cs =================================================================== diff -u -r255ffcdbfd4ffff68c336ad9922e6196636c2803 -r14185c4e29bcfc887fa656a681bdde704d250a9f --- Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/PresentationObjects/PipingCalculationGroupContextTest.cs (.../PipingCalculationGroupContextTest.cs) (revision 255ffcdbfd4ffff68c336ad9922e6196636c2803) +++ Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/PresentationObjects/PipingCalculationGroupContextTest.cs (.../PipingCalculationGroupContextTest.cs) (revision 14185c4e29bcfc887fa656a681bdde704d250a9f) @@ -1,5 +1,4 @@ -using System.Linq; -using Core.Common.Base; +using Core.Common.Base; using NUnit.Framework; using Rhino.Mocks; using Ringtoets.Common.Data.AssessmentSection; @@ -47,85 +46,5 @@ Assert.AreSame(pipingFailureMechanismMock, groupContext.FailureMechanism); Assert.AreSame(assessmentSection, groupContext.AssessmentSection); } - - [Test] - public void Attach_Observer_ObserverAttachedToCalculationGroup() - { - // Setup - var mocks = new MockRepository(); - var assessmentSectionMock = new MockRepository().StrictMock(); - var pipingFailureMechanismMock = mocks.StrictMock(); - var observer = mocks.StrictMock(); - observer.Expect(o => o.UpdateObserver()); - mocks.ReplayAll(); - - var calculationGroup = new CalculationGroup(); - - var context = new PipingCalculationGroupContext(calculationGroup, - Enumerable.Empty(), - Enumerable.Empty(), - pipingFailureMechanismMock, assessmentSectionMock); - - // Call - context.Attach(observer); - - // Assert - calculationGroup.NotifyObservers(); // Notification on wrapped object - mocks.VerifyAll(); // Expected UpdateObserver call - } - - [Test] - public void Detach_Observer_ObserverDetachedFromCalculationGroup() - { - // Setup - var mocks = new MockRepository(); - var assessmentSectionMock = new MockRepository().StrictMock(); - var pipingFailureMechanismMock = mocks.StrictMock(); - var observer = mocks.StrictMock(); - mocks.ReplayAll(); - - var calculationGroup = new CalculationGroup(); - - var context = new PipingCalculationGroupContext(calculationGroup, - Enumerable.Empty(), - Enumerable.Empty(), - pipingFailureMechanismMock, assessmentSectionMock); - - context.Attach(observer); - - // Call - context.Detach(observer); - - // Assert - calculationGroup.NotifyObservers(); // Notification on wrapped object - mocks.VerifyAll(); // Expected no UpdateObserver call - } - - [Test] - public void NotifyObservers_ObserverAttachedToPipingCalculationGroup_NotificationCorrectlyPropagated() - { - // Setup - var mocks = new MockRepository(); - var assessmentSectionMock = new MockRepository().StrictMock(); - var pipingFailureMechanismMock = mocks.StrictMock(); - var observer = mocks.StrictMock(); - observer.Expect(o => o.UpdateObserver()); - mocks.ReplayAll(); - - var calculationGroup = new CalculationGroup(); - - var context = new PipingCalculationGroupContext(calculationGroup, - Enumerable.Empty(), - Enumerable.Empty(), - pipingFailureMechanismMock, assessmentSectionMock); - - calculationGroup.Attach(observer); // Attach to wrapped object - - // Call - context.NotifyObservers(); // Notification on context - - // Assert - mocks.VerifyAll(); - } } } \ No newline at end of file Index: Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/PresentationObjects/PipingCalculationScenarioContextTest.cs =================================================================== diff -u -rbb0aeecc47206f5089ab04ca6c3575a1de8c206f -r14185c4e29bcfc887fa656a681bdde704d250a9f --- Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/PresentationObjects/PipingCalculationScenarioContextTest.cs (.../PipingCalculationScenarioContextTest.cs) (revision bb0aeecc47206f5089ab04ca6c3575a1de8c206f) +++ Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/PresentationObjects/PipingCalculationScenarioContextTest.cs (.../PipingCalculationScenarioContextTest.cs) (revision 14185c4e29bcfc887fa656a681bdde704d250a9f) @@ -45,100 +45,5 @@ Assert.AreSame(pipingFailureMechanismMock, presentationObject.FailureMechanism); Assert.AreSame(assessmentSectionMock, presentationObject.AssessmentSection); } - - [Test] - public void Attach_Observer_ObserverAttachedToPipingCalculation() - { - // Setup - var mocks = new MockRepository(); - var pipingFailureMechanismMock = mocks.StrictMock(); - var assessmentSectionMock = mocks.StrictMock(); - var observer = mocks.StrictMock(); - observer.Expect(o => o.UpdateObserver()); - mocks.ReplayAll(); - - var surfacelines = new[] - { - new RingtoetsPipingSurfaceLine() - }; - var soilModels = new[] - { - new TestStochasticSoilModel() - }; - - var calculation = new PipingCalculationScenario(new GeneralPipingInput()); - var context = new PipingCalculationScenarioContext(calculation, surfacelines, soilModels, pipingFailureMechanismMock, assessmentSectionMock); - - // Call - context.Attach(observer); - - // Assert - calculation.NotifyObservers(); // Notification on wrapped object - mocks.VerifyAll(); // Expected UpdateObserver call - } - - [Test] - public void Detach_Observer_ObserverDetachedFromPipingCalculation() - { - // Setup - var mocks = new MockRepository(); - var pipingFailureMechanismMock = mocks.StrictMock(); - var assessmentSectionMock = mocks.StrictMock(); - var observer = mocks.StrictMock(); - mocks.ReplayAll(); - - var surfacelines = new[] - { - new RingtoetsPipingSurfaceLine() - }; - var soilModels = new[] - { - new TestStochasticSoilModel() - }; - - var calculation = new PipingCalculationScenario(new GeneralPipingInput()); - var context = new PipingCalculationScenarioContext(calculation, surfacelines, soilModels, pipingFailureMechanismMock, assessmentSectionMock); - - context.Attach(observer); - - // Call - context.Detach(observer); - - // Assert - calculation.NotifyObservers(); // Notification on wrapped object - mocks.VerifyAll(); // Expected no UpdateObserver call - } - - [Test] - public void NotifyObservers_ObserverAttachedToPipingCalculation_NotificationCorrectlyPropagated() - { - // Setup - var mocks = new MockRepository(); - var pipingFailureMechanismMock = mocks.StrictMock(); - var assessmentSectionMock = mocks.StrictMock(); - var observer = mocks.StrictMock(); - observer.Expect(o => o.UpdateObserver()); - mocks.ReplayAll(); - - var surfacelines = new[] - { - new RingtoetsPipingSurfaceLine() - }; - var soilModels = new[] - { - new TestStochasticSoilModel() - }; - - var calculation = new PipingCalculationScenario(new GeneralPipingInput()); - var context = new PipingCalculationScenarioContext(calculation, surfacelines, soilModels, pipingFailureMechanismMock, assessmentSectionMock); - - calculation.Attach(observer); // Attach to wrapped object - - // Call - context.NotifyObservers(); // Notification on context - - // Assert - mocks.VerifyAll(); - } } } \ No newline at end of file Index: Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/PresentationObjects/PipingContextTest.cs =================================================================== diff -u -r44568559b13a82c0ed7640ff2d5648552a0d7add -r14185c4e29bcfc887fa656a681bdde704d250a9f --- Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/PresentationObjects/PipingContextTest.cs (.../PipingContextTest.cs) (revision 44568559b13a82c0ed7640ff2d5648552a0d7add) +++ Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/PresentationObjects/PipingContextTest.cs (.../PipingContextTest.cs) (revision 14185c4e29bcfc887fa656a681bdde704d250a9f) @@ -49,7 +49,7 @@ RingtoetsPipingSurfaceLine[] surfaceLines = { new RingtoetsPipingSurfaceLine(), - new RingtoetsPipingSurfaceLine(), + new RingtoetsPipingSurfaceLine() }; var soilModels = new[] @@ -77,32 +77,6 @@ } [Test] - public void ParameteredConstructor_DataIsNull_ThrowArgumentNullException() - { - // Setup - var mocks = new MockRepository(); - var assessmentSection = mocks.StrictMock(); - var pipingFailureMechanism = mocks.StrictMock(); - mocks.ReplayAll(); - - // Call - TestDelegate call = () => new SimplePipingContext(null, - Enumerable.Empty(), - Enumerable.Empty(), - pipingFailureMechanism, - assessmentSection); - - // Assert - var exception = Assert.Throws(call); - string customMessage = exception.Message.Split(new[] - { - Environment.NewLine - }, StringSplitOptions.None)[0]; - Assert.AreEqual("Wrapped data of context cannot be null.", customMessage); - mocks.VerifyAll(); - } - - [Test] public void ParameteredConstructor_SurfaceLinesIsNull_ThrowArgumentNullException() { // Setup @@ -204,292 +178,6 @@ mocks.VerifyAll(); } - [Test] - public void Attach_Observer_ObserverAttachedToWrappedObject() - { - // Setup - var mocks = new MockRepository(); - var assessmentSection = mocks.StrictMock(); - var pipingFailureMechanism = mocks.StrictMock(); - var observer = mocks.StrictMock(); - observer.Expect(o => o.UpdateObserver()); - mocks.ReplayAll(); - - var observableObject = new ObservableObject(); - - var context = new SimplePipingContext(observableObject, - Enumerable.Empty(), - Enumerable.Empty(), - pipingFailureMechanism, - assessmentSection); - - // Call - context.Attach(observer); - - // Assert - observableObject.NotifyObservers(); // Notification on wrapped object - mocks.VerifyAll(); // Expected UpdateObserver call - } - - [Test] - public void Detach_Observer_ObserverDetachedFromWrappedObject() - { - // Setup - var mocks = new MockRepository(); - var assessmentSection = mocks.StrictMock(); - var pipingFailureMechanism = mocks.StrictMock(); - var observer = mocks.StrictMock(); - mocks.ReplayAll(); - - var observableObject = new ObservableObject(); - - var context = new SimplePipingContext(observableObject, - Enumerable.Empty(), - Enumerable.Empty(), - pipingFailureMechanism, - assessmentSection); - - context.Attach(observer); - - // Call - context.Detach(observer); - - // Assert - observableObject.NotifyObservers(); // Notification on wrapped object - mocks.VerifyAll(); // Expected no UpdateObserver call - } - - [Test] - public void NotifyObservers_ObserverAttachedToWrappedObject_NotificationCorrectlyPropagated() - { - // Setup - var mocks = new MockRepository(); - var assessmentSection = mocks.StrictMock(); - var pipingFailureMechanism = mocks.StrictMock(); - var observer = mocks.StrictMock(); - observer.Expect(o => o.UpdateObserver()); - mocks.ReplayAll(); - - var observableObject = new ObservableObject(); - - var context = new SimplePipingContext(observableObject, - Enumerable.Empty(), - Enumerable.Empty(), - pipingFailureMechanism, - assessmentSection); - - observableObject.Attach(observer); // Attach to wrapped object - - // Call - context.NotifyObservers(); // Notification on context - - // Assert - mocks.VerifyAll(); - } - - [Test] - public void Equals_ToItself_ReturnTrue() - { - // Setup - var mocks = new MockRepository(); - var assessmentSection = mocks.StrictMock(); - var pipingFailureMechanism = mocks.StrictMock(); - mocks.ReplayAll(); - - var observableObject = new ObservableObject(); - var context = new SimplePipingContext(observableObject, - Enumerable.Empty(), - Enumerable.Empty(), - pipingFailureMechanism, - assessmentSection); - - // Call - bool isEqual = context.Equals(context); - - // Assert - Assert.IsTrue(isEqual); - mocks.VerifyAll(); - } - - [Test] - public void Equals_ToNull_ReturnFalse() - { - // Setup - var mocks = new MockRepository(); - var assessmentSection = mocks.StrictMock(); - var pipingFailureMechanism = mocks.StrictMock(); - mocks.ReplayAll(); - - var observableObject = new ObservableObject(); - var context = new SimplePipingContext(observableObject, - Enumerable.Empty(), - Enumerable.Empty(), - pipingFailureMechanism, - assessmentSection); - - // Call - bool isEqual = context.Equals(null); - - // Assert - Assert.IsFalse(isEqual); - mocks.VerifyAll(); - } - - [Test] - public void Equals_ToEqualOtherInstance_ReturnTrue() - { - // Setup - var mocks = new MockRepository(); - var assessmentSection = mocks.StrictMock(); - var pipingFailureMechanism = mocks.StrictMock(); - mocks.ReplayAll(); - - var observableObject = new ObservableObject(); - var context = new SimplePipingContext(observableObject, - Enumerable.Empty(), - Enumerable.Empty(), - pipingFailureMechanism, - assessmentSection); - - var otherContext = new SimplePipingContext(observableObject, - new[] - { - new RingtoetsPipingSurfaceLine() - }, - new[] - { - new StochasticSoilModel(0, string.Empty, string.Empty) - }, - pipingFailureMechanism, - assessmentSection); - - // Call - bool isEqual = context.Equals(otherContext); - bool isEqual2 = otherContext.Equals(context); - - // Assert - Assert.IsTrue(isEqual); - Assert.IsTrue(isEqual2); - mocks.VerifyAll(); - } - - [Test] - public void Equals_ToInequalOtherInstance_ReturnFalse() - { - // Setup - var mocks = new MockRepository(); - var assessmentSection = mocks.StrictMock(); - var pipingFailureMechanism = mocks.StrictMock(); - mocks.ReplayAll(); - - var observableObject = new ObservableObject(); - var otherObservableObject = new ObservableObject(); - var context = new SimplePipingContext(observableObject, - Enumerable.Empty(), - Enumerable.Empty(), - pipingFailureMechanism, - assessmentSection); - - var otherContext = new SimplePipingContext(otherObservableObject, - new[] - { - new RingtoetsPipingSurfaceLine() - }, - new[] - { - new StochasticSoilModel(0, string.Empty, string.Empty) - }, - pipingFailureMechanism, - assessmentSection); - - // Call - bool isEqual = context.Equals(otherContext); - bool isEqual2 = otherContext.Equals(context); - - // Assert - Assert.IsFalse(isEqual); - Assert.IsFalse(isEqual2); - mocks.VerifyAll(); - } - - [Test] - public void Equals_ToOtherGenericType_ReturnFalse() - { - // Setup - var mocks = new MockRepository(); - var assessmentSection = mocks.StrictMock(); - var pipingFailureMechanism = mocks.StrictMock(); - var observableStub = mocks.Stub(); - mocks.ReplayAll(); - - var observableObject = new ObservableObject(); - var context = new SimplePipingContext(observableObject, - Enumerable.Empty(), - Enumerable.Empty(), - pipingFailureMechanism, - assessmentSection); - - var otherContext = new SimplePipingContext(observableStub, - new[] - { - new RingtoetsPipingSurfaceLine() - }, - new[] - { - new StochasticSoilModel(0, string.Empty, string.Empty) - }, - pipingFailureMechanism, - assessmentSection); - - // Call - bool isEqual = context.Equals(otherContext); - bool isEqual2 = otherContext.Equals(context); - - // Assert - Assert.IsFalse(isEqual); - Assert.IsFalse(isEqual2); - mocks.VerifyAll(); - } - - [Test] - public void GetHashCode_TwoContextInstancesEqualToEachOther_ReturnIdenticalHashes() - { - // Setup - var mocks = new MockRepository(); - var assessmentSection = mocks.StrictMock(); - var pipingFailureMechanism = mocks.StrictMock(); - mocks.ReplayAll(); - - var observableObject = new ObservableObject(); - var context = new SimplePipingContext(observableObject, - Enumerable.Empty(), - Enumerable.Empty(), - pipingFailureMechanism, - assessmentSection); - - var otherContext = new SimplePipingContext(observableObject, - new[] - { - new RingtoetsPipingSurfaceLine() - }, - new[] - { - new StochasticSoilModel(0, string.Empty, string.Empty) - }, - pipingFailureMechanism, - assessmentSection); - // Precondition - Assert.True(context.Equals(otherContext)); - - // Call - int contextHashCode = context.GetHashCode(); - int otherContextHashCode = otherContext.GetHashCode(); - - // Assert - Assert.AreEqual(contextHashCode, otherContextHashCode); - mocks.VerifyAll(); - } - private class SimplePipingContext : PipingContext where T : IObservable { public SimplePipingContext(T target, IEnumerable surfaceLines, IEnumerable stochasticSoilModels, PipingFailureMechanism pipingFailureMechanism, IAssessmentSection assessmentSection) Index: Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/PresentationObjects/PipingFailureMechanismContextTest.cs =================================================================== diff -u -rc4d2af65ad23757fb3bd11f93458839bc1787ded -r14185c4e29bcfc887fa656a681bdde704d250a9f --- Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/PresentationObjects/PipingFailureMechanismContextTest.cs (.../PipingFailureMechanismContextTest.cs) (revision c4d2af65ad23757fb3bd11f93458839bc1787ded) +++ Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/PresentationObjects/PipingFailureMechanismContextTest.cs (.../PipingFailureMechanismContextTest.cs) (revision 14185c4e29bcfc887fa656a681bdde704d250a9f) @@ -34,22 +34,6 @@ } [Test] - public void Constructor_FailureMechanismIsNull_ThrowArgumentNullException() - { - // Setup - var mocks = new MockRepository(); - var assessmentSection = mocks.Stub(); - mocks.ReplayAll(); - - // Call - TestDelegate call = () => new PipingFailureMechanismContext(null, assessmentSection); - - // Assert - Assert.Throws(call); - mocks.VerifyAll(); - } - - [Test] public void Constructor_AssessmentSectionIsNull_ThrowArgumentNullException() { // Setup Index: Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/PresentationObjects/PipingInputContextTest.cs =================================================================== diff -u -rbb0aeecc47206f5089ab04ca6c3575a1de8c206f -r14185c4e29bcfc887fa656a681bdde704d250a9f --- Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/PresentationObjects/PipingInputContextTest.cs (.../PipingInputContextTest.cs) (revision bb0aeecc47206f5089ab04ca6c3575a1de8c206f) +++ Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/PresentationObjects/PipingInputContextTest.cs (.../PipingInputContextTest.cs) (revision 14185c4e29bcfc887fa656a681bdde704d250a9f) @@ -20,8 +20,6 @@ // All rights reserved. using System; -using System.Linq; -using Core.Common.Base; using Core.Common.TestUtil; using NUnit.Framework; using Rhino.Mocks; @@ -98,88 +96,5 @@ TestHelper.AssertThrowsArgumentExceptionAndTestMessage(call, "De berekening mag niet 'null' zijn."); mocks.VerifyAll(); } - - [Test] - public void Attach_Observer_ObserverAttachedToPipingInput() - { - // Setup - var mocks = new MockRepository(); - var assessmentSectionMock = mocks.StrictMock(); - var observer = mocks.StrictMock(); - observer.Expect(o => o.UpdateObserver()); - mocks.ReplayAll(); - - var calculation = new PipingCalculationScenario(new GeneralPipingInput()); - var failureMechanism = new PipingFailureMechanism(); - var context = new PipingInputContext(calculation.InputParameters, - calculation, - Enumerable.Empty(), - Enumerable.Empty(), - failureMechanism, - assessmentSectionMock); - - // Call - context.Attach(observer); - - // Assert - calculation.InputParameters.NotifyObservers(); // Notification on wrapped object - mocks.VerifyAll(); // Expected UpdateObserver call - } - - [Test] - public void Detach_Observer_ObserverDetachedFromPipingInput() - { - // Setup - var mocks = new MockRepository(); - var assessmentSectionMock = mocks.StrictMock(); - var observer = mocks.StrictMock(); - mocks.ReplayAll(); - - var calculation = new PipingCalculationScenario(new GeneralPipingInput()); - var failureMechanism = new PipingFailureMechanism(); - var context = new PipingInputContext(calculation.InputParameters, - calculation, - Enumerable.Empty(), - Enumerable.Empty(), - failureMechanism, - assessmentSectionMock); - - context.Attach(observer); - - // Call - context.Detach(observer); - - // Assert - calculation.InputParameters.NotifyObservers(); // Notification on wrapped object - mocks.VerifyAll(); // Expected no UpdateObserver call - } - - [Test] - public void NotifyObservers_ObserverAttachedToPipingInput_NotificationCorrectlyPropagated() - { - // Setup - var mocks = new MockRepository(); - var assessmentSectionMock = mocks.StrictMock(); - var observer = mocks.StrictMock(); - observer.Expect(o => o.UpdateObserver()); - mocks.ReplayAll(); - - var calculationItem = new PipingCalculationScenario(new GeneralPipingInput()); - var failureMechanism = new PipingFailureMechanism(); - var context = new PipingInputContext(calculationItem.InputParameters, - calculationItem, - Enumerable.Empty(), - Enumerable.Empty(), - failureMechanism, - assessmentSectionMock); - - calculationItem.InputParameters.Attach(observer); // Attach to wrapped object - - // Call - context.NotifyObservers(); // Notification on context - - // Assert - mocks.VerifyAll(); - } } } \ No newline at end of file Index: Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/TreeNodeInfos/PipingCalculationScenarioContextTreeNodeInfoTest.cs =================================================================== diff -u -r14de3deecd2cff7f6abe41ed6dc5dc016c4c81e0 -r14185c4e29bcfc887fa656a681bdde704d250a9f --- Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/TreeNodeInfos/PipingCalculationScenarioContextTreeNodeInfoTest.cs (.../PipingCalculationScenarioContextTreeNodeInfoTest.cs) (revision 14de3deecd2cff7f6abe41ed6dc5dc016c4c81e0) +++ Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/TreeNodeInfos/PipingCalculationScenarioContextTreeNodeInfoTest.cs (.../PipingCalculationScenarioContextTreeNodeInfoTest.cs) (revision 14185c4e29bcfc887fa656a681bdde704d250a9f) @@ -121,7 +121,7 @@ Assert.AreEqual(3, children.Length); var commentContext = children[0] as CommentContext; Assert.IsNotNull(commentContext); - Assert.AreSame(pipingCalculationContext.WrappedData, commentContext.CommentContainer); + Assert.AreSame(pipingCalculationContext.WrappedData, commentContext.WrappedData); var pipingInputContext = (PipingInputContext) children[1]; Assert.AreSame(pipingCalculationContext.WrappedData.InputParameters, pipingInputContext.WrappedData); @@ -154,7 +154,7 @@ Assert.AreEqual(3, children.Length); var commentContext = children[0] as CommentContext; Assert.IsNotNull(commentContext); - Assert.AreSame(pipingCalculationContext.WrappedData, commentContext.CommentContainer); + Assert.AreSame(pipingCalculationContext.WrappedData, commentContext.WrappedData); var pipingInputContext = (PipingInputContext) children[1]; Assert.AreSame(pipingCalculationContext.WrappedData.InputParameters, pipingInputContext.WrappedData); Index: Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/TreeNodeInfos/PipingFailureMechanismContextTreeNodeInfoTest.cs =================================================================== diff -u -rbb0aeecc47206f5089ab04ca6c3575a1de8c206f -r14185c4e29bcfc887fa656a681bdde704d250a9f --- Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/TreeNodeInfos/PipingFailureMechanismContextTreeNodeInfoTest.cs (.../PipingFailureMechanismContextTreeNodeInfoTest.cs) (revision bb0aeecc47206f5089ab04ca6c3575a1de8c206f) +++ Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/TreeNodeInfos/PipingFailureMechanismContextTreeNodeInfoTest.cs (.../PipingFailureMechanismContextTreeNodeInfoTest.cs) (revision 14185c4e29bcfc887fa656a681bdde704d250a9f) @@ -153,7 +153,7 @@ Assert.AreSame(assessmentSection, stochasticSoilModelContext.AssessmentSection); var commentContext = (CommentContext) inputsFolder.Contents[3]; - Assert.AreSame(pipingFailureMechanism, commentContext.CommentContainer); + Assert.AreSame(pipingFailureMechanism, commentContext.WrappedData); var calculationsFolder = (PipingCalculationGroupContext) children[1]; Assert.AreEqual("Berekeningen", calculationsFolder.WrappedData.Name); @@ -168,7 +168,7 @@ var failureMechanismResultsContext = (FailureMechanismSectionResultContext)outputsFolder.Contents[0]; Assert.AreSame(pipingFailureMechanism, failureMechanismResultsContext.FailureMechanism); - Assert.AreSame(pipingFailureMechanism.SectionResults, failureMechanismResultsContext.SectionResults); + Assert.AreSame(pipingFailureMechanism.SectionResults, failureMechanismResultsContext.WrappedData); mocks.VerifyAll(); } @@ -195,7 +195,7 @@ // Assert Assert.AreEqual(1, children.Length); var commentContext = (CommentContext) children[0]; - Assert.AreSame(pipingFailureMechanism, commentContext.CommentContainer); + Assert.AreSame(pipingFailureMechanism, commentContext.WrappedData); mocks.VerifyAll(); }