Index: Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/PresentationObjects/GrassCoverErosionInwardsCalculationGroupContextTest.cs =================================================================== diff -u -rb1a215180352084c8f320439c1893c639917f338 -r9c97b82cdd55ddd5fbe5143110bbbbf576bda162 --- Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/PresentationObjects/GrassCoverErosionInwardsCalculationGroupContextTest.cs (.../GrassCoverErosionInwardsCalculationGroupContextTest.cs) (revision b1a215180352084c8f320439c1893c639917f338) +++ Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/PresentationObjects/GrassCoverErosionInwardsCalculationGroupContextTest.cs (.../GrassCoverErosionInwardsCalculationGroupContextTest.cs) (revision 9c97b82cdd55ddd5fbe5143110bbbbf576bda162) @@ -32,18 +32,11 @@ [TestFixture] public class GrassCoverErosionInwardsCalculationGroupContextTest { - private MockRepository mockRepository; - - [SetUp] - public void SetUp() - { - mockRepository = new MockRepository(); - } - [Test] public void ParameteredConstructor_ExpectedValues() { // Setup + var mockRepository = new MockRepository(); var calculationGroup = new CalculationGroup(); var assessmentSectionMock = mockRepository.StrictMock(); var failureMechanismMock = mockRepository.StrictMock(); @@ -53,84 +46,11 @@ var groupContext = new GrassCoverErosionInwardsCalculationGroupContext(calculationGroup, failureMechanismMock, assessmentSectionMock); // Assert - Assert.IsInstanceOf(groupContext); Assert.IsInstanceOf>(groupContext); Assert.AreSame(calculationGroup, groupContext.WrappedData); Assert.AreSame(failureMechanismMock, groupContext.FailureMechanism); Assert.AreSame(assessmentSectionMock, groupContext.AssessmentSection); mockRepository.VerifyAll(); } - - [Test] - public void Attach_Observer_ObserverAttachedToCalculationGroup() - { - // Setup - var assessmentSectionMock = new MockRepository().StrictMock(); - var failureMechanismMock = mockRepository.StrictMock(); - var observerMock = mockRepository.StrictMock(); - observerMock.Expect(o => o.UpdateObserver()); - mockRepository.ReplayAll(); - - var calculationGroup = new CalculationGroup(); - - var context = new GrassCoverErosionInwardsCalculationGroupContext(calculationGroup, - failureMechanismMock, assessmentSectionMock); - - // Call - context.Attach(observerMock); - - // Assert - calculationGroup.NotifyObservers(); // Notification on wrapped object - mockRepository.VerifyAll(); // Expected UpdateObserver call - } - - [Test] - public void Detach_Observer_ObserverDetachedFromCalculationGroup() - { - // Setup - var assessmentSectionMock = new MockRepository().StrictMock(); - var failureMechanismMock = mockRepository.StrictMock(); - var observer = mockRepository.StrictMock(); - mockRepository.ReplayAll(); - - var calculationGroup = new CalculationGroup(); - - var context = new GrassCoverErosionInwardsCalculationGroupContext(calculationGroup, - failureMechanismMock, assessmentSectionMock); - - // Precondition - context.Attach(observer); - - // Call - context.Detach(observer); - - // Assert - calculationGroup.NotifyObservers(); // Notification on wrapped object - mockRepository.VerifyAll(); // Expected no UpdateObserver call - } - - [Test] - public void NotifyObservers_ObserverAttachedToCalculationGroup_NotificationCorrectlyPropagated() - { - // Setup - var assessmentSectionMock = new MockRepository().StrictMock(); - var failureMechanismMock = mockRepository.StrictMock(); - var observer = mockRepository.StrictMock(); - observer.Expect(o => o.UpdateObserver()); - mockRepository.ReplayAll(); - - var calculationGroup = new CalculationGroup(); - - var context = new GrassCoverErosionInwardsCalculationGroupContext(calculationGroup, - failureMechanismMock, assessmentSectionMock); - - calculationGroup.Attach(observer); // Attach to wrapped object - - // Call - context.NotifyObservers(); // Notification on context - - // Assert - mockRepository.VerifyAll(); - } } } \ No newline at end of file Index: Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.Forms/PresentationObjects/HeightStructuresCalculationGroupContext.cs =================================================================== diff -u --- Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.Forms/PresentationObjects/HeightStructuresCalculationGroupContext.cs (revision 0) +++ Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.Forms/PresentationObjects/HeightStructuresCalculationGroupContext.cs (revision 9c97b82cdd55ddd5fbe5143110bbbbf576bda162) @@ -0,0 +1,44 @@ +// Copyright (C) Stichting Deltares 2016. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using Ringtoets.Common.Data.AssessmentSection; +using Ringtoets.Common.Data.Calculation; +using Ringtoets.Common.Forms.PresentationObjects; +using Ringtoets.HeightStructures.Data; + +namespace Ringtoets.HeightStructures.Forms.PresentationObjects +{ + /// + /// Presentation object for all data required to configure an instance of + /// in order be able to create configurable height structures calculations. + /// + public class HeightStructuresCalculationGroupContext : HeightStructuresContext, ICalculationContext + { + /// + /// Creates a new instance of . + /// + /// The instance wrapped by this context object. + /// The failure mechanism which the context belongs to. + /// The assessment section which the context belongs to. + public HeightStructuresCalculationGroupContext(CalculationGroup calculationsGroup, HeightStructuresFailureMechanism failureMechanism, IAssessmentSection assessmentSection) + : base(calculationsGroup, failureMechanism, assessmentSection) {} + } +} Index: Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.Forms/Ringtoets.HeightStructures.Forms.csproj =================================================================== diff -u -r29fc3cf43f0885270cca5b57c8bf17e347ae9609 -r9c97b82cdd55ddd5fbe5143110bbbbf576bda162 --- Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.Forms/Ringtoets.HeightStructures.Forms.csproj (.../Ringtoets.HeightStructures.Forms.csproj) (revision 29fc3cf43f0885270cca5b57c8bf17e347ae9609) +++ Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.Forms/Ringtoets.HeightStructures.Forms.csproj (.../Ringtoets.HeightStructures.Forms.csproj) (revision 9c97b82cdd55ddd5fbe5143110bbbbf576bda162) @@ -39,6 +39,7 @@ Properties\GlobalAssembly.cs + Index: Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Forms.Test/PresentationObjects/HeightStructuresCalculationGroupContextTest.cs =================================================================== diff -u --- Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Forms.Test/PresentationObjects/HeightStructuresCalculationGroupContextTest.cs (revision 0) +++ Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Forms.Test/PresentationObjects/HeightStructuresCalculationGroupContextTest.cs (revision 9c97b82cdd55ddd5fbe5143110bbbbf576bda162) @@ -0,0 +1,55 @@ +// Copyright (C) Stichting Deltares 2016. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using NUnit.Framework; +using Rhino.Mocks; +using Ringtoets.Common.Data.AssessmentSection; +using Ringtoets.Common.Data.Calculation; +using Ringtoets.HeightStructures.Data; +using Ringtoets.HeightStructures.Forms.PresentationObjects; + +namespace Ringtoets.HeightStructures.Forms.Test.PresentationObjects +{ + [TestFixture] + public class HeightStructuresCalculationGroupContextTest + { + [Test] + public void ParameteredConstructor_ExpectedValues() + { + // Setup + var mockRepository = new MockRepository(); + var calculationGroup = new CalculationGroup(); + var assessmentSectionMock = mockRepository.StrictMock(); + var failureMechanismMock = mockRepository.StrictMock(); + mockRepository.ReplayAll(); + + // Call + var groupContext = new HeightStructuresCalculationGroupContext(calculationGroup, failureMechanismMock, assessmentSectionMock); + + // Assert + Assert.IsInstanceOf>(groupContext); + Assert.AreSame(calculationGroup, groupContext.WrappedData); + Assert.AreSame(failureMechanismMock, groupContext.FailureMechanism); + Assert.AreSame(assessmentSectionMock, groupContext.AssessmentSection); + mockRepository.VerifyAll(); + } + } +} Index: Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Forms.Test/Ringtoets.HeightStructures.Forms.Test.csproj =================================================================== diff -u -r29fc3cf43f0885270cca5b57c8bf17e347ae9609 -r9c97b82cdd55ddd5fbe5143110bbbbf576bda162 --- Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Forms.Test/Ringtoets.HeightStructures.Forms.Test.csproj (.../Ringtoets.HeightStructures.Forms.Test.csproj) (revision 29fc3cf43f0885270cca5b57c8bf17e347ae9609) +++ Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Forms.Test/Ringtoets.HeightStructures.Forms.Test.csproj (.../Ringtoets.HeightStructures.Forms.Test.csproj) (revision 9c97b82cdd55ddd5fbe5143110bbbbf576bda162) @@ -49,6 +49,7 @@ +