Index: Ringtoets/ClosingStructures/src/Ringtoets.ClosingStructures.Forms/PresentationObjects/ClosingStructuresCalculationGroupContext.cs
===================================================================
diff -u -r0153023b4f33722b801edf55eba942048c261779 -r8587508c66a1bc0938465e97cf365cc1ef254f53
--- Ringtoets/ClosingStructures/src/Ringtoets.ClosingStructures.Forms/PresentationObjects/ClosingStructuresCalculationGroupContext.cs (.../ClosingStructuresCalculationGroupContext.cs) (revision 0153023b4f33722b801edf55eba942048c261779)
+++ Ringtoets/ClosingStructures/src/Ringtoets.ClosingStructures.Forms/PresentationObjects/ClosingStructuresCalculationGroupContext.cs (.../ClosingStructuresCalculationGroupContext.cs) (revision 8587508c66a1bc0938465e97cf365cc1ef254f53)
@@ -31,7 +31,7 @@
/// Presentation object for all data required to configure an instance of
/// in order to be able to create configurable closing structures calculations.
///
- public class ClosingStructuresCalculationGroupContext : ClosingStructuresContext, ICalculationContext
+ public class ClosingStructuresCalculationGroupContext : ClosingStructuresContextBase, ICalculationContext
{
///
/// Creates a new instance of .
Fisheye: Tag 8587508c66a1bc0938465e97cf365cc1ef254f53 refers to a dead (removed) revision in file `Ringtoets/ClosingStructures/src/Ringtoets.ClosingStructures.Forms/PresentationObjects/ClosingStructuresContext.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Ringtoets/ClosingStructures/src/Ringtoets.ClosingStructures.Forms/PresentationObjects/ClosingStructuresContextBase.cs
===================================================================
diff -u
--- Ringtoets/ClosingStructures/src/Ringtoets.ClosingStructures.Forms/PresentationObjects/ClosingStructuresContextBase.cs (revision 0)
+++ Ringtoets/ClosingStructures/src/Ringtoets.ClosingStructures.Forms/PresentationObjects/ClosingStructuresContextBase.cs (revision 8587508c66a1bc0938465e97cf365cc1ef254f53)
@@ -0,0 +1,79 @@
+// 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 System;
+using Core.Common.Base;
+using Core.Common.Controls.PresentationObjects;
+using Ringtoets.ClosingStructures.Data;
+using Ringtoets.ClosingStructures.Forms.Properties;
+using Ringtoets.Common.Data.AssessmentSection;
+using RingtoetsCommonFormsResources = Ringtoets.Common.Forms.Properties.Resources;
+
+namespace Ringtoets.ClosingStructures.Forms.PresentationObjects
+{
+ ///
+ /// Presentation object representing all required closing structures input knowledge to configure and create
+ /// related objects. It will delegate observable behaviour to the wrapped data object.
+ ///
+ public abstract class ClosingStructuresContextBase : ObservableWrappedObjectContextBase where T : IObservable
+ {
+ ///
+ /// Initializes a new instance of .
+ ///
+ /// The concrete data instance wrapped by the context object.
+ /// The failure mechanism which the context belongs to.
+ /// The assessment section which the context belongs to.
+ /// Thrown when any of the input parameters are null.
+ protected ClosingStructuresContextBase(T wrappedData,
+ ClosingStructuresFailureMechanism failureMechanism,
+ IAssessmentSection assessmentSection)
+ : base(wrappedData)
+ {
+ if (failureMechanism == null)
+ {
+ string message = string.Format(RingtoetsCommonFormsResources.AssertInputsAreNotNull_DataDescription_0_cannot_be_null,
+ Resources.ClosingStructuresContextBase_DataDescription_ClosingStructuresFailureMechanism);
+ throw new ArgumentNullException("failureMechanism", message);
+ }
+
+ if (assessmentSection == null)
+ {
+ string message = string.Format(RingtoetsCommonFormsResources.AssertInputsAreNotNull_DataDescription_0_cannot_be_null,
+ RingtoetsCommonFormsResources.FailureMechanismContext_DataDescription_AssessmentSection);
+
+ throw new ArgumentNullException("assessmentSection", message);
+ }
+
+ FailureMechanism = failureMechanism;
+ AssessmentSection = assessmentSection;
+ }
+
+ ///
+ /// Gets the assessment section for this instance.
+ ///
+ public IAssessmentSection AssessmentSection { get; private set; }
+
+ ///
+ /// Gets the failure mechanism for this instance.
+ ///
+ public ClosingStructuresFailureMechanism FailureMechanism { get; private set; }
+ }
+}
\ No newline at end of file
Index: Ringtoets/ClosingStructures/src/Ringtoets.ClosingStructures.Forms/Properties/Resources.Designer.cs
===================================================================
diff -u -re8162b5b22781fbe2258f99aa208e38f3ead9133 -r8587508c66a1bc0938465e97cf365cc1ef254f53
--- Ringtoets/ClosingStructures/src/Ringtoets.ClosingStructures.Forms/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision e8162b5b22781fbe2258f99aa208e38f3ead9133)
+++ Ringtoets/ClosingStructures/src/Ringtoets.ClosingStructures.Forms/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 8587508c66a1bc0938465e97cf365cc1ef254f53)
@@ -22,7 +22,7 @@
//------------------------------------------------------------------------------
//
// This code was generated by a tool.
-// Runtime Version:4.0.30319.34209
+// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
@@ -84,9 +84,9 @@
///
/// Looks up a localized string similar to Het sluitings kunstwerk toetsspoor.
///
- public static string ClosingStructuresContext_DataDescription_ClosingStructuresFailureMechanism {
+ public static string ClosingStructuresContextBase_DataDescription_ClosingStructuresFailureMechanism {
get {
- return ResourceManager.GetString("ClosingStructuresContext_DataDescription_ClosingStructuresFailureMechanism", resourceCulture);
+ return ResourceManager.GetString("ClosingStructuresContextBase_DataDescription_ClosingStructuresFailureMechanism", resourceCulture);
}
}
}
Index: Ringtoets/ClosingStructures/src/Ringtoets.ClosingStructures.Forms/Properties/Resources.resx
===================================================================
diff -u -re8162b5b22781fbe2258f99aa208e38f3ead9133 -r8587508c66a1bc0938465e97cf365cc1ef254f53
--- Ringtoets/ClosingStructures/src/Ringtoets.ClosingStructures.Forms/Properties/Resources.resx (.../Resources.resx) (revision e8162b5b22781fbe2258f99aa208e38f3ead9133)
+++ Ringtoets/ClosingStructures/src/Ringtoets.ClosingStructures.Forms/Properties/Resources.resx (.../Resources.resx) (revision 8587508c66a1bc0938465e97cf365cc1ef254f53)
@@ -117,7 +117,7 @@
System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
+
Het sluitings kunstwerk toetsspoor
\ No newline at end of file
Index: Ringtoets/ClosingStructures/src/Ringtoets.ClosingStructures.Forms/Ringtoets.ClosingStructures.Forms.csproj
===================================================================
diff -u -r0153023b4f33722b801edf55eba942048c261779 -r8587508c66a1bc0938465e97cf365cc1ef254f53
--- Ringtoets/ClosingStructures/src/Ringtoets.ClosingStructures.Forms/Ringtoets.ClosingStructures.Forms.csproj (.../Ringtoets.ClosingStructures.Forms.csproj) (revision 0153023b4f33722b801edf55eba942048c261779)
+++ Ringtoets/ClosingStructures/src/Ringtoets.ClosingStructures.Forms/Ringtoets.ClosingStructures.Forms.csproj (.../Ringtoets.ClosingStructures.Forms.csproj) (revision 8587508c66a1bc0938465e97cf365cc1ef254f53)
@@ -42,7 +42,7 @@
-
+
@@ -101,6 +101,7 @@
PublicResXFileCodeGenerator
Resources.Designer.cs
+ Designer
Index: Ringtoets/ClosingStructures/test/Ringtoets.ClosingStructures.Forms.Test/PresentationObjects/ClosingStructuresCalculationGroupContextTest.cs
===================================================================
diff -u -rf02ecc2ee4949596335f3c9792dd77d4120a14bd -r8587508c66a1bc0938465e97cf365cc1ef254f53
--- Ringtoets/ClosingStructures/test/Ringtoets.ClosingStructures.Forms.Test/PresentationObjects/ClosingStructuresCalculationGroupContextTest.cs (.../ClosingStructuresCalculationGroupContextTest.cs) (revision f02ecc2ee4949596335f3c9792dd77d4120a14bd)
+++ Ringtoets/ClosingStructures/test/Ringtoets.ClosingStructures.Forms.Test/PresentationObjects/ClosingStructuresCalculationGroupContextTest.cs (.../ClosingStructuresCalculationGroupContextTest.cs) (revision 8587508c66a1bc0938465e97cf365cc1ef254f53)
@@ -47,7 +47,7 @@
var groupContext = new ClosingStructuresCalculationGroupContext(calculationGroup, failureMechanism, assessmentSectionMock);
// Assert
- Assert.IsInstanceOf>(groupContext);
+ Assert.IsInstanceOf>(groupContext);
Assert.IsInstanceOf>(groupContext);
Assert.AreSame(calculationGroup, groupContext.WrappedData);
Assert.AreSame(failureMechanism, groupContext.FailureMechanism);
Index: Ringtoets/ClosingStructures/test/Ringtoets.ClosingStructures.Forms.Test/PresentationObjects/ClosingStructuresContextBaseTest.cs
===================================================================
diff -u
--- Ringtoets/ClosingStructures/test/Ringtoets.ClosingStructures.Forms.Test/PresentationObjects/ClosingStructuresContextBaseTest.cs (revision 0)
+++ Ringtoets/ClosingStructures/test/Ringtoets.ClosingStructures.Forms.Test/PresentationObjects/ClosingStructuresContextBaseTest.cs (revision 8587508c66a1bc0938465e97cf365cc1ef254f53)
@@ -0,0 +1,101 @@
+// 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 System;
+using Core.Common.Base;
+using Core.Common.Controls.PresentationObjects;
+using Core.Common.TestUtil;
+using NUnit.Framework;
+using Rhino.Mocks;
+using Ringtoets.ClosingStructures.Data;
+using Ringtoets.ClosingStructures.Forms.PresentationObjects;
+using Ringtoets.Common.Data.AssessmentSection;
+
+namespace Ringtoets.ClosingStructures.Forms.Test.PresentationObjects
+{
+ [TestFixture]
+ public class ClosingStructuresContextBaseTest
+ {
+ [Test]
+ public void ParameteredConstructor_ExpectedValues()
+ {
+ // Setup
+ var mockRepository = new MockRepository();
+ var assessmentSectionMock = mockRepository.StrictMock();
+ var target = mockRepository.Stub();
+ mockRepository.ReplayAll();
+
+ var failureMechanism = new ClosingStructuresFailureMechanism();
+
+ // Call
+ var context = new SimpleClosingStructuresContext(target, failureMechanism, assessmentSectionMock);
+
+ // Assert
+ Assert.IsInstanceOf>(context);
+ Assert.AreSame(target, context.WrappedData);
+ Assert.AreSame(assessmentSectionMock, context.AssessmentSection);
+ Assert.AreSame(failureMechanism, context.FailureMechanism);
+ mockRepository.VerifyAll();
+ }
+
+ [Test]
+ public void ParameteredConstructor_FailureMechanismIsNull_ThrowsArgumentNullException()
+ {
+ // Setup
+ var mockRepository = new MockRepository();
+ var assessmentSectionMock = mockRepository.Stub();
+ var observableObject = mockRepository.Stub();
+ mockRepository.ReplayAll();
+
+ // Call
+ TestDelegate call = () => new SimpleClosingStructuresContext(observableObject, null, assessmentSectionMock);
+
+ // Assert
+ const string expectedMessage = "Het sluitings kunstwerk toetsspoor mag niet 'null' zijn.";
+ TestHelper.AssertThrowsArgumentExceptionAndTestMessage(call, expectedMessage);
+ mockRepository.VerifyAll();
+ }
+
+ [Test]
+ public void ParameteredConstructor_AssessmentSectionIsNull_ThrowsArgumentNullException()
+ {
+ // Setup
+ var mockRepository = new MockRepository();
+ var observableObject = mockRepository.Stub();
+ mockRepository.ReplayAll();
+
+ var failureMechanism = new ClosingStructuresFailureMechanism();
+
+ // Call
+ TestDelegate call = () => new SimpleClosingStructuresContext(observableObject, failureMechanism, null);
+
+ // Assert
+ const string expectedMessage = "Het traject mag niet 'null' zijn.";
+ TestHelper.AssertThrowsArgumentExceptionAndTestMessage(call, expectedMessage);
+ }
+
+ private class SimpleClosingStructuresContext : ClosingStructuresContextBase where T : IObservable
+ {
+ public SimpleClosingStructuresContext(T target, ClosingStructuresFailureMechanism failureMechanism, IAssessmentSection assessmentSection)
+ : base(target, failureMechanism, assessmentSection) { }
+ }
+ }
+}
Fisheye: Tag 8587508c66a1bc0938465e97cf365cc1ef254f53 refers to a dead (removed) revision in file `Ringtoets/ClosingStructures/test/Ringtoets.ClosingStructures.Forms.Test/PresentationObjects/ClosingStructuresContextTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Ringtoets/ClosingStructures/test/Ringtoets.ClosingStructures.Forms.Test/Ringtoets.ClosingStructures.Forms.Test.csproj
===================================================================
diff -u -rf994b1077b45f107c38c87b94ddeb5e91e1f95fe -r8587508c66a1bc0938465e97cf365cc1ef254f53
--- Ringtoets/ClosingStructures/test/Ringtoets.ClosingStructures.Forms.Test/Ringtoets.ClosingStructures.Forms.Test.csproj (.../Ringtoets.ClosingStructures.Forms.Test.csproj) (revision f994b1077b45f107c38c87b94ddeb5e91e1f95fe)
+++ Ringtoets/ClosingStructures/test/Ringtoets.ClosingStructures.Forms.Test/Ringtoets.ClosingStructures.Forms.Test.csproj (.../Ringtoets.ClosingStructures.Forms.Test.csproj) (revision 8587508c66a1bc0938465e97cf365cc1ef254f53)
@@ -59,7 +59,7 @@
-
+