Index: Ringtoets/Common/src/Ringtoets.Common.Data/FailureMechanism/FailureMechanismSection.cs =================================================================== diff -u -r4bb55feac151da4010e81849de3103327f7f40ae -rdec46d5efaad5332ffb2a96e67ec11209ddc5515 --- Ringtoets/Common/src/Ringtoets.Common.Data/FailureMechanism/FailureMechanismSection.cs (.../FailureMechanismSection.cs) (revision 4bb55feac151da4010e81849de3103327f7f40ae) +++ Ringtoets/Common/src/Ringtoets.Common.Data/FailureMechanism/FailureMechanismSection.cs (.../FailureMechanismSection.cs) (revision dec46d5efaad5332ffb2a96e67ec11209ddc5515) @@ -87,6 +87,8 @@ /// public IEnumerable Points { get; private set; } + public long StorageId { get; set; } + /// /// Gets the geometric start of the section. /// @@ -103,6 +105,12 @@ return geometryEnd; } - public long StorageId { get; set; } + /// + /// Gets the length of the section. + /// + public double GetSectionLength() + { + return Math2D.ConvertLinePointsToLineSegments(Points).Sum(segment => segment.Length); + } } } \ No newline at end of file Index: Ringtoets/Common/test/Ringtoets.Common.Data.Test/FailureMechanism/FailureMechanismSectionTest.cs =================================================================== diff -u -r1e4d77c17c6eac78bfd705efdff9e52b4fca2c7e -rdec46d5efaad5332ffb2a96e67ec11209ddc5515 --- Ringtoets/Common/test/Ringtoets.Common.Data.Test/FailureMechanism/FailureMechanismSectionTest.cs (.../FailureMechanismSectionTest.cs) (revision 1e4d77c17c6eac78bfd705efdff9e52b4fca2c7e) +++ Ringtoets/Common/test/Ringtoets.Common.Data.Test/FailureMechanism/FailureMechanismSectionTest.cs (.../FailureMechanismSectionTest.cs) (revision dec46d5efaad5332ffb2a96e67ec11209ddc5515) @@ -135,5 +135,23 @@ // Assert Assert.AreEqual(geometryPoints[1], endingPoint); } + + [Test] + public void GetSectionLength_SectionWithPoints_ReturnLength() + { + // Setup + var geometryPoints = new[] + { + new Point2D(1, 2), + new Point2D(3, 4) + }; + var section = new FailureMechanismSection("A", geometryPoints); + + // Call + double sectionLength = section.GetSectionLength(); + + // Assert + Assert.AreEqual(2.828427, sectionLength, 1e-6); + } } } \ No newline at end of file Index: Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Data/GrassCoverErosionInwardsCalculation.cs =================================================================== diff -u -r61f2445be56feb2180cb0990d8889164c17b79f0 -rdec46d5efaad5332ffb2a96e67ec11209ddc5515 --- Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Data/GrassCoverErosionInwardsCalculation.cs (.../GrassCoverErosionInwardsCalculation.cs) (revision 61f2445be56feb2180cb0990d8889164c17b79f0) +++ Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Data/GrassCoverErosionInwardsCalculation.cs (.../GrassCoverErosionInwardsCalculation.cs) (revision dec46d5efaad5332ffb2a96e67ec11209ddc5515) @@ -108,7 +108,7 @@ }; var foreshoreSections = new[] { - new RoughnessProfileSection(new Point2D(3.3, 4.4), new Point2D(5.5, 6.6), 2.2) + new ProfileSection(new Point2D(3.3, 4.4), new Point2D(5.5, 6.6)) }; InputParameters.SetDikeGeometry(dikeSections); InputParameters.SetForeshoreGeometry(foreshoreSections); Index: Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Data/GrassCoverErosionInwardsFailureMechanism.cs =================================================================== diff -u -r392c4a63ebfaee062d8dc611ecf41881ac1fe3a5 -rdec46d5efaad5332ffb2a96e67ec11209ddc5515 --- Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Data/GrassCoverErosionInwardsFailureMechanism.cs (.../GrassCoverErosionInwardsFailureMechanism.cs) (revision 392c4a63ebfaee062d8dc611ecf41881ac1fe3a5) +++ Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Data/GrassCoverErosionInwardsFailureMechanism.cs (.../GrassCoverErosionInwardsFailureMechanism.cs) (revision dec46d5efaad5332ffb2a96e67ec11209ddc5515) @@ -20,6 +20,7 @@ // All rights reserved. using System.Collections.Generic; +using System.Linq; using Ringtoets.Common.Data.Calculation; using Ringtoets.Common.Data.FailureMechanism; using Ringtoets.GrassCoverErosionInwards.Data.Properties; @@ -46,7 +47,7 @@ { get { - return CalculationsGroup.GetGrassCoverErosionInwardsCalculations(); + return CalculationsGroup.GetCalculations().OfType(); } } Index: Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Data/GrassCoverErosionInwardsInput.cs =================================================================== diff -u -r61f2445be56feb2180cb0990d8889164c17b79f0 -rdec46d5efaad5332ffb2a96e67ec11209ddc5515 --- Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Data/GrassCoverErosionInwardsInput.cs (.../GrassCoverErosionInwardsInput.cs) (revision 61f2445be56feb2180cb0990d8889164c17b79f0) +++ Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Data/GrassCoverErosionInwardsInput.cs (.../GrassCoverErosionInwardsInput.cs) (revision dec46d5efaad5332ffb2a96e67ec11209ddc5515) @@ -58,7 +58,7 @@ BreakWater = new BreakWater(BreakWaterType.Caisson, 0); criticalFlowRate = new LognormalDistribution(2); DikeGeometry = Enumerable.Empty(); - ForeshoreGeometry = Enumerable.Empty(); + ForeshoreGeometry = Enumerable.Empty(); } /// @@ -69,7 +69,7 @@ /// /// Gets the dike's foreshore geometry. /// - public IEnumerable ForeshoreGeometry { get; private set; } + public IEnumerable ForeshoreGeometry { get; private set; } /// /// Gets or sets the dike's orientation @@ -155,7 +155,7 @@ /// Sets the grass cover erosion inwards foreshore geometry. /// /// The grass cover erosion inwards geometry points. - public void SetForeshoreGeometry(IEnumerable profileSections) + public void SetForeshoreGeometry(IEnumerable profileSections) { if (profileSections == null) { Fisheye: Tag dec46d5efaad5332ffb2a96e67ec11209ddc5515 refers to a dead (removed) revision in file `Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Data/IGrassCoverErosionInwardsCalculationBaseExtensions.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Data/ProfileSection.cs =================================================================== diff -u --- Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Data/ProfileSection.cs (revision 0) +++ Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Data/ProfileSection.cs (revision dec46d5efaad5332ffb2a96e67ec11209ddc5515) @@ -0,0 +1,65 @@ +// 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.Geometry; + +namespace Ringtoets.GrassCoverErosionInwards.Data +{ + /// + /// This class represents a sub-section of a line and the characteristic properties of that line. + /// + public class ProfileSection + { + /// + /// Creates a new instance of the class. + /// + /// Starting point of the section. + /// Ending point of the section. + /// Thrown when: + /// is null. + /// is null. + /// + public ProfileSection(Point2D startingPoint, Point2D endingPoint) + { + if (startingPoint == null) + { + throw new ArgumentNullException("startingPoint"); + } + if (endingPoint == null) + { + throw new ArgumentNullException("endingPoint"); + } + StartingPoint = startingPoint; + EndingPoint = endingPoint; + } + + /// + /// Gets the starting 2D geometry point of the . + /// + public Point2D StartingPoint { get; private set; } + + /// + /// Gets the ending 2D geometry point of the . + /// + public Point2D EndingPoint { get; private set; } + } +} \ No newline at end of file Index: Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Data/Ringtoets.GrassCoverErosionInwards.Data.csproj =================================================================== diff -u -r61f2445be56feb2180cb0990d8889164c17b79f0 -rdec46d5efaad5332ffb2a96e67ec11209ddc5515 --- Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Data/Ringtoets.GrassCoverErosionInwards.Data.csproj (.../Ringtoets.GrassCoverErosionInwards.Data.csproj) (revision 61f2445be56feb2180cb0990d8889164c17b79f0) +++ Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Data/Ringtoets.GrassCoverErosionInwards.Data.csproj (.../Ringtoets.GrassCoverErosionInwards.Data.csproj) (revision dec46d5efaad5332ffb2a96e67ec11209ddc5515) @@ -47,8 +47,8 @@ - + Index: Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Data/RoughnessProfileSection.cs =================================================================== diff -u -rd2de88a141d3ba20d1f3b301a3c38723b682b206 -rdec46d5efaad5332ffb2a96e67ec11209ddc5515 --- Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Data/RoughnessProfileSection.cs (.../RoughnessProfileSection.cs) (revision d2de88a141d3ba20d1f3b301a3c38723b682b206) +++ Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Data/RoughnessProfileSection.cs (.../RoughnessProfileSection.cs) (revision dec46d5efaad5332ffb2a96e67ec11209ddc5515) @@ -25,9 +25,9 @@ namespace Ringtoets.GrassCoverErosionInwards.Data { /// - /// This class represents a sub-section of a line and the characteristic properties of that line. + /// This class represents a sub-section of a line and the characteristic properties of that line with a roughness. /// - public class RoughnessProfileSection + public class RoughnessProfileSection : ProfileSection { /// /// Creates a new instance of the class. @@ -39,32 +39,12 @@ /// is null. /// is null. /// - public RoughnessProfileSection(Point2D startingPoint, Point2D endingPoint, double roughness) + public RoughnessProfileSection(Point2D startingPoint, Point2D endingPoint, double roughness) : base(startingPoint, endingPoint) { - if (startingPoint == null) - { - throw new ArgumentNullException("startingPoint"); - } - if (endingPoint == null) - { - throw new ArgumentNullException("endingPoint"); - } - StartingPoint = startingPoint; - EndingPoint = endingPoint; Roughness = roughness; } /// - /// Gets the starting 2D geometry point of the . - /// - public Point2D StartingPoint { get; private set; } - - /// - /// Gets the ending 2D geometry point of the . - /// - public Point2D EndingPoint { get; private set; } - - /// /// Gets the roughness of the . /// public double Roughness { get; private set; } Index: Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Plugin/GrassCoverErosionInwardsGuiPlugin.cs =================================================================== diff -u -r9643d7e5bbb27a7782b5d939b029a70a1c023138 -rdec46d5efaad5332ffb2a96e67ec11209ddc5515 --- Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Plugin/GrassCoverErosionInwardsGuiPlugin.cs (.../GrassCoverErosionInwardsGuiPlugin.cs) (revision 9643d7e5bbb27a7782b5d939b029a70a1c023138) +++ Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Plugin/GrassCoverErosionInwardsGuiPlugin.cs (.../GrassCoverErosionInwardsGuiPlugin.cs) (revision dec46d5efaad5332ffb2a96e67ec11209ddc5515) @@ -32,6 +32,7 @@ using Ringtoets.Common.Data; using Ringtoets.Common.Data.AssessmentSection; using Ringtoets.Common.Data.Calculation; +using Ringtoets.Common.Data.FailureMechanism; using Ringtoets.Common.Forms.Helpers; using Ringtoets.Common.Forms.PresentationObjects; using Ringtoets.Common.Forms.TreeNodeInfos; @@ -106,27 +107,30 @@ }; } - private static ExceedanceProbabilityCalculationActivity CreateHydraRingTargetProbabilityCalculationActivity(HydraulicBoundaryLocation hydraulicBoundaryLocation, + private static ExceedanceProbabilityCalculationActivity CreateHydraRingTargetProbabilityCalculationActivity(FailureMechanismSection failureMechanismSection, + HydraulicBoundaryLocation hydraulicBoundaryLocation, string hlcdDirectory, - GrassCoverErosionInwardsInput inwardsInput, - GrassCoverErosionInwardsOutput inwardsOutput + GrassCoverErosionInwardsCalculation calculation ) { var hydraulicBoundaryLocationId = (int) hydraulicBoundaryLocation.Id; + var sectionLength = failureMechanismSection.GetSectionLength(); + var inwardsInput = calculation.InputParameters; + var inwardsOutput = calculation.Output; return HydraRingActivityFactory.Create( - string.Format(Resources.GrassCoverErosionInwardsGuiPlugin_Calculate_overtopping_for_location_0_, hydraulicBoundaryLocationId), + calculation.Name, hlcdDirectory, - hydraulicBoundaryLocationId.ToString(), + failureMechanismSection.Name, // TODO: Provide name of reference line instead HydraRingTimeIntegrationSchemeType.FBC, HydraRingUncertaintiesType.All, - new OvertoppingCalculationInput(hydraulicBoundaryLocationId, new HydraRingSection(hydraulicBoundaryLocationId, hydraulicBoundaryLocationId.ToString(), double.NaN, double.NaN, double.NaN, double.NaN, double.NaN, double.NaN), + new OvertoppingCalculationInput(hydraulicBoundaryLocationId, new HydraRingSection(hydraulicBoundaryLocationId, failureMechanismSection.Name, sectionLength, inwardsInput.Orientation), inwardsInput.DikeHeight, inwardsInput.CriticalOvertoppingModelFactor, inwardsInput.FbFactor.Mean, inwardsInput.FbFactor.StandardDeviation, inwardsInput.FnFactor.Mean, inwardsInput.FnFactor.StandardDeviation, inwardsInput.OvertoppingModelFactor, - inwardsInput.CriticalFlowRate.StandardDeviation, inwardsInput.CriticalFlowRate.Mean, + inwardsInput.CriticalFlowRate.Mean, inwardsInput.CriticalFlowRate.StandardDeviation, inwardsInput.FrunupModelFactor.Mean, inwardsInput.FrunupModelFactor.StandardDeviation, inwardsInput.FshallowModelFactor.Mean, inwardsInput.FshallowModelFactor.StandardDeviation, ParseProfilePoints(inwardsInput.DikeGeometry), @@ -143,16 +147,14 @@ private static IEnumerable ParseForeshore(GrassCoverErosionInwardsInput input) { - if (!input.UseForeshore) + var firstProfileSection = input.ForeshoreGeometry.FirstOrDefault(); + if (!input.UseForeshore || firstProfileSection == null) { yield break; } - if (input.ForeshoreGeometry.Any()) - { - var first = input.ForeshoreGeometry.First(); - yield return new HydraRingForelandPoint(first.StartingPoint.X, first.StartingPoint.Y); - } + yield return new HydraRingForelandPoint(firstProfileSection.StartingPoint.X, firstProfileSection.StartingPoint.Y); + foreach (var foreshore in input.ForeshoreGeometry) { yield return new HydraRingForelandPoint(foreshore.EndingPoint.X, foreshore.EndingPoint.Y); @@ -161,12 +163,15 @@ private static IEnumerable ParseProfilePoints(IEnumerable profileSections) { - if (profileSections.Any()) + var firstProfileSection = profileSections.FirstOrDefault(); + if (firstProfileSection == null) { - var first = profileSections.First(); - yield return new HydraRingRoughnessProfilePoint(first.StartingPoint.X, first.StartingPoint.Y, 0); + yield break; } + // By default, the roughness is 1.0 (no reduction due to bed friction). + yield return new HydraRingRoughnessProfilePoint(firstProfileSection.StartingPoint.X, firstProfileSection.StartingPoint.Y, 1); + foreach (var profileSection in profileSections) { yield return new HydraRingRoughnessProfilePoint(profileSection.EndingPoint.X, profileSection.EndingPoint.Y, profileSection.Roughness); Index: Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Plugin/Properties/Resources.Designer.cs =================================================================== diff -u -r2e826fe82412e8333f9d4cb2e2eece2f3b3c6509 -rdec46d5efaad5332ffb2a96e67ec11209ddc5515 --- Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Plugin/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 2e826fe82412e8333f9d4cb2e2eece2f3b3c6509) +++ Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Plugin/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision dec46d5efaad5332ffb2a96e67ec11209ddc5515) @@ -61,15 +61,6 @@ } /// - /// Looks up a localized string similar to Faalkans berekenen voor locatie '{0}'. - /// - internal static string GrassCoverErosionInwardsGuiPlugin_Calculate_overtopping_for_location_0_ { - get { - return ResourceManager.GetString("GrassCoverErosionInwardsGuiPlugin_Calculate_overtopping_for_location_0_", resourceCulture); - } - } - - /// /// Looks up a localized string similar to Er is een fout opgetreden tijdens de berekening.. /// internal static string GrassCoverErosionInwardsGuiPlugin_Error_during_overtopping_calculation { Index: Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Plugin/Properties/Resources.resx =================================================================== diff -u -r2e826fe82412e8333f9d4cb2e2eece2f3b3c6509 -rdec46d5efaad5332ffb2a96e67ec11209ddc5515 --- Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Plugin/Properties/Resources.resx (.../Resources.resx) (revision 2e826fe82412e8333f9d4cb2e2eece2f3b3c6509) +++ Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Plugin/Properties/Resources.resx (.../Resources.resx) (revision dec46d5efaad5332ffb2a96e67ec11209ddc5515) @@ -120,7 +120,4 @@ Er is een fout opgetreden tijdens de berekening. - - Faalkans berekenen voor locatie '{0}' - \ No newline at end of file Index: Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Data.Test/GrassCoverErosionInwardsFailureMechanismTest.cs =================================================================== diff -u -r392c4a63ebfaee062d8dc611ecf41881ac1fe3a5 -rdec46d5efaad5332ffb2a96e67ec11209ddc5515 --- Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Data.Test/GrassCoverErosionInwardsFailureMechanismTest.cs (.../GrassCoverErosionInwardsFailureMechanismTest.cs) (revision 392c4a63ebfaee062d8dc611ecf41881ac1fe3a5) +++ Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Data.Test/GrassCoverErosionInwardsFailureMechanismTest.cs (.../GrassCoverErosionInwardsFailureMechanismTest.cs) (revision dec46d5efaad5332ffb2a96e67ec11209ddc5515) @@ -22,7 +22,6 @@ using Core.Common.Base; using NUnit.Framework; using Rhino.Mocks; -using Ringtoets.Common.Data.Calculation; using Ringtoets.Common.Data.FailureMechanism; using Ringtoets.GrassCoverErosionInwards.Data.Properties; @@ -147,71 +146,5 @@ grassCoverErosionInwardsFailureMechanism.Detach(observer); mockRepository.VerifyAll(); } - - [Test] - public void Calculations_AddGrassCoverErosionInwardsCalculation_ItemIsAddedToCollection() - { - // Setup - var calculationMock = mockRepository.StrictMock(); - mockRepository.ReplayAll(); - - var failureMechanism = new GrassCoverErosionInwardsFailureMechanism(); - - // Call - failureMechanism.CalculationsGroup.Children.Add(calculationMock); - - // Assert - CollectionAssert.Contains(failureMechanism.CalculationsGroup.Children, calculationMock); - mockRepository.VerifyAll(); - } - - [Test] - public void Calculations_RemoveGrassCoverErosionInwardsCalculation_ItemIsRemovedFromCollection() - { - // Setup - var calculationMock = mockRepository.StrictMock(); - mockRepository.ReplayAll(); - - var failureMechanism = new GrassCoverErosionInwardsFailureMechanism(); - failureMechanism.CalculationsGroup.Children.Add(calculationMock); - - // Call - failureMechanism.CalculationsGroup.Children.Remove(calculationMock); - - // Assert - CollectionAssert.DoesNotContain(failureMechanism.CalculationsGroup.Children, calculationMock); - mockRepository.VerifyAll(); - } - - [Test] - public void Calculations_AddCalculationGroup_ItemIsAddedToCollection() - { - // Setup - var folder = new CalculationGroup(); - - var failureMechanism = new GrassCoverErosionInwardsFailureMechanism(); - - // Call - failureMechanism.CalculationsGroup.Children.Add(folder); - - // Assert - CollectionAssert.Contains(failureMechanism.CalculationsGroup.Children, folder); - } - - [Test] - public void Calculations_RemoveCalculationGroup_ItemIsRemovedFromCollection() - { - // Setup - var folder = new CalculationGroup(); - - var failureMechanism = new GrassCoverErosionInwardsFailureMechanism(); - failureMechanism.CalculationsGroup.Children.Add(folder); - - // Call - failureMechanism.CalculationsGroup.Children.Remove(folder); - - // Assert - CollectionAssert.DoesNotContain(failureMechanism.CalculationsGroup.Children, folder); - } } } \ No newline at end of file Index: Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Data.Test/GrassCoverErosionInwardsInputTest.cs =================================================================== diff -u -r61f2445be56feb2180cb0990d8889164c17b79f0 -rdec46d5efaad5332ffb2a96e67ec11209ddc5515 --- Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Data.Test/GrassCoverErosionInwardsInputTest.cs (.../GrassCoverErosionInwardsInputTest.cs) (revision 61f2445be56feb2180cb0990d8889164c17b79f0) +++ Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Data.Test/GrassCoverErosionInwardsInputTest.cs (.../GrassCoverErosionInwardsInputTest.cs) (revision dec46d5efaad5332ffb2a96e67ec11209ddc5515) @@ -115,7 +115,7 @@ } [Test] - public void SetForeshoreGeometry_NullRoughnessProfileSections_ThrowsArgumentNullException() + public void SetForeshoreGeometry_NullProfileSections_ThrowsArgumentNullException() { // Setup var generalInput = new GeneralGrassCoverErosionInwardsInput(); @@ -155,8 +155,8 @@ var input = new GrassCoverErosionInwardsInput(generalInput); var sections = new[] { - new RoughnessProfileSection(new Point2D(1.1, 2.2), new Point2D(3.3, 4.4), 1.1), - new RoughnessProfileSection(new Point2D(3.3, 4.4), new Point2D(5.5, 6.6), 2.2) + new ProfileSection(new Point2D(1.1, 2.2), new Point2D(3.3, 4.4)), + new ProfileSection(new Point2D(3.3, 4.4), new Point2D(5.5, 6.6)) }; // Call Index: Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Data.Test/GrassCoverErosionInwardsOutputTest.cs =================================================================== diff -u -r2e826fe82412e8333f9d4cb2e2eece2f3b3c6509 -rdec46d5efaad5332ffb2a96e67ec11209ddc5515 --- Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Data.Test/GrassCoverErosionInwardsOutputTest.cs (.../GrassCoverErosionInwardsOutputTest.cs) (revision 2e826fe82412e8333f9d4cb2e2eece2f3b3c6509) +++ Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Data.Test/GrassCoverErosionInwardsOutputTest.cs (.../GrassCoverErosionInwardsOutputTest.cs) (revision dec46d5efaad5332ffb2a96e67ec11209ddc5515) @@ -52,7 +52,7 @@ } [Test] - public void FactorOfSafety_VariousValues_ReturnsExpectedValues() + public void FactorOfSafety_BigRoundedDouble_ReturnsExpectedValues() { // Setup var bigRoundedDouble = new RoundedDouble(15, 9.12345678901234567); @@ -67,7 +67,7 @@ } [Test] - public void Reliability_VariousValues_ReturnsExpectedValues() + public void Reliability_BigRoundedDouble_ReturnsExpectedValues() { // Setup var bigRoundedDouble = new RoundedDouble(15, 9.12345678901234567); @@ -82,7 +82,7 @@ } [Test] - public void Probability_VariousValues_ReturnsExpectedValues() + public void Probability_BigRoundedDouble_ReturnsExpectedValues() { // Setup var bigRoundedDouble = new RoundedDouble(15, 9.12345678901234567); Fisheye: Tag dec46d5efaad5332ffb2a96e67ec11209ddc5515 refers to a dead (removed) revision in file `Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Data.Test/IGrassCoverErosionInwardsCalculationBaseExtensionsTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Data.Test/ProfileSectionTest.cs =================================================================== diff -u --- Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Data.Test/ProfileSectionTest.cs (revision 0) +++ Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Data.Test/ProfileSectionTest.cs (revision dec46d5efaad5332ffb2a96e67ec11209ddc5515) @@ -0,0 +1,69 @@ +// 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.Geometry; +using NUnit.Framework; + +namespace Ringtoets.GrassCoverErosionInwards.Data.Test +{ + [TestFixture] + public class ProfileSectionTest + { + [Test] + public void Constructor_ExpectedValues() + { + // Setup + var begin = new Point2D(1.1, 2.2); + var end = new Point2D(3.3, 4.4); + + // Call + ProfileSection profileSection = new ProfileSection(begin, end); + + // Assert + Assert.IsNotNull(profileSection); + Assert.AreEqual(begin, profileSection.StartingPoint); + Assert.AreEqual(end, profileSection.EndingPoint); + } + + [Test] + public void Constructor_StartingPointNull_ThrowsArgumentNullException() + { + // Setup & Call + TestDelegate test = () => new ProfileSection(null, new Point2D(3.3, 4.4)); + + // Assert + var exception = Assert.Throws(test); + Assert.AreEqual("startingPoint", exception.ParamName); + } + + [Test] + public void Constructor_EndingPointNull_ThrowsArgumentNullException() + { + // Setup & Call + TestDelegate test = () => new ProfileSection(new Point2D(3.3, 4.4), null); + + // Assert + var exception = Assert.Throws(test); + Assert.AreEqual("endingPoint", exception.ParamName); + } + } +} \ No newline at end of file Index: Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Data.Test/Ringtoets.GrassCoverErosionInwards.Data.Test.csproj =================================================================== diff -u -r392c4a63ebfaee062d8dc611ecf41881ac1fe3a5 -rdec46d5efaad5332ffb2a96e67ec11209ddc5515 --- Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Data.Test/Ringtoets.GrassCoverErosionInwards.Data.Test.csproj (.../Ringtoets.GrassCoverErosionInwards.Data.Test.csproj) (revision 392c4a63ebfaee062d8dc611ecf41881ac1fe3a5) +++ Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Data.Test/Ringtoets.GrassCoverErosionInwards.Data.Test.csproj (.../Ringtoets.GrassCoverErosionInwards.Data.Test.csproj) (revision dec46d5efaad5332ffb2a96e67ec11209ddc5515) @@ -57,8 +57,8 @@ - + Index: Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Data.Test/RoughnessProfileSectionTest.cs =================================================================== diff -u -r54c270e65b7ea51ec9855500fbc7cd9f5869fceb -rdec46d5efaad5332ffb2a96e67ec11209ddc5515 --- Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Data.Test/RoughnessProfileSectionTest.cs (.../RoughnessProfileSectionTest.cs) (revision 54c270e65b7ea51ec9855500fbc7cd9f5869fceb) +++ Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Data.Test/RoughnessProfileSectionTest.cs (.../RoughnessProfileSectionTest.cs) (revision dec46d5efaad5332ffb2a96e67ec11209ddc5515) @@ -40,7 +40,7 @@ RoughnessProfileSection roughnessProfileSection = new RoughnessProfileSection(begin, end, roughness); // Assert - Assert.IsNotNull(roughnessProfileSection); + Assert.IsInstanceOf(roughnessProfileSection); Assert.AreEqual(begin, roughnessProfileSection.StartingPoint); Assert.AreEqual(end, roughnessProfileSection.EndingPoint); Assert.AreEqual(roughness, roughnessProfileSection.Roughness); Index: Ringtoets/HydraRing/src/Ringtoets.HydraRing.Calculation/Activities/HydraRingActivityFactory.cs =================================================================== diff -u -r74f9fae7e26c7ba15c1ef5681c51acf842f76122 -rdec46d5efaad5332ffb2a96e67ec11209ddc5515 --- Ringtoets/HydraRing/src/Ringtoets.HydraRing.Calculation/Activities/HydraRingActivityFactory.cs (.../HydraRingActivityFactory.cs) (revision 74f9fae7e26c7ba15c1ef5681c51acf842f76122) +++ Ringtoets/HydraRing/src/Ringtoets.HydraRing.Calculation/Activities/HydraRingActivityFactory.cs (.../HydraRingActivityFactory.cs) (revision dec46d5efaad5332ffb2a96e67ec11209ddc5515) @@ -44,7 +44,7 @@ /// The to use while executing the calculation. /// The to use while executing the calculation. /// The input of the calculation to perform. - /// The action to perform after the calculation is performed. + /// The action to perform after the calculation is performed. /// Thrown when one of the string arguments is null or empty. /// Thrown when one of the other arguments is null. public static TargetProbabilityCalculationActivity Create(string name, @@ -53,34 +53,11 @@ HydraRingTimeIntegrationSchemeType timeIntegrationSchemeType, HydraRingUncertaintiesType uncertaintiesType, TargetProbabilityCalculationInput targetProbabilityCalculationInput, - Action handleCalculationOutputAction) + Action action) { - if (string.IsNullOrEmpty(name)) - { - throw new ArgumentException("Name should be set.", "name"); - } + VerifyCalculationActivityInput(name, hlcdDirectory, ringId, timeIntegrationSchemeType, uncertaintiesType, targetProbabilityCalculationInput, action); - if (string.IsNullOrEmpty(hlcdDirectory)) - { - throw new ArgumentException("HLCD directory should be set.", "hlcdDirectory"); - } - - if (string.IsNullOrEmpty(ringId)) - { - throw new ArgumentException("Ring id should be set.", "ringId"); - } - - if (targetProbabilityCalculationInput == null) - { - throw new ArgumentNullException("targetProbabilityCalculationInput", "Calculation input should be set."); - } - - if (handleCalculationOutputAction == null) - { - throw new ArgumentNullException("handleCalculationOutputAction", "Handle calculation output action should be set."); - } - - return new TargetProbabilityCalculationActivity(name, hlcdDirectory, ringId, timeIntegrationSchemeType, uncertaintiesType, targetProbabilityCalculationInput, handleCalculationOutputAction, hydraRingCalculationService); + return new TargetProbabilityCalculationActivity(name, hlcdDirectory, ringId, timeIntegrationSchemeType, uncertaintiesType, targetProbabilityCalculationInput, action, hydraRingCalculationService); } /// @@ -92,7 +69,7 @@ /// The to use while executing the calculation. /// The to use while executing the calculation. /// The input of the calculation to perform. - /// The action to perform after the calculation is performed. + /// The action to perform after the calculation is performed. /// Thrown when one of the string arguments is null or empty. /// Thrown when one of the other arguments is null. public static ExceedanceProbabilityCalculationActivity Create(string name, @@ -101,34 +78,41 @@ HydraRingTimeIntegrationSchemeType timeIntegrationSchemeType, HydraRingUncertaintiesType uncertaintiesType, ExceedanceProbabilityCalculationInput exceedanceProbabilityCalculationInput, - Action handleCalculationOutputAction) + Action action) { + VerifyCalculationActivityInput(name, hlcdDirectory, ringId, timeIntegrationSchemeType, uncertaintiesType, exceedanceProbabilityCalculationInput, action); + + return new ExceedanceProbabilityCalculationActivity(name, hlcdDirectory, ringId, timeIntegrationSchemeType, uncertaintiesType, exceedanceProbabilityCalculationInput, action, hydraRingCalculationService); + } + + private static void VerifyCalculationActivityInput(string name, string hlcdDirectory, string ringId, HydraRingTimeIntegrationSchemeType timeIntegrationSchemeType, + HydraRingUncertaintiesType uncertaintiesType, HydraRingCalculationInput hydraRingCalculationInput, + object action) + { if (string.IsNullOrEmpty(name)) { - throw new ArgumentException("Name should be set.", "name"); + throw new ArgumentException(@"Name should be set.", "name"); } if (string.IsNullOrEmpty(hlcdDirectory)) { - throw new ArgumentException("HLCD directory should be set.", "hlcdDirectory"); + throw new ArgumentException(@"HLCD directory should be set.", "hlcdDirectory"); } if (string.IsNullOrEmpty(ringId)) { - throw new ArgumentException("Ring id should be set.", "ringId"); + throw new ArgumentException(@"Ring id should be set.", "ringId"); } - if (exceedanceProbabilityCalculationInput == null) + if (hydraRingCalculationInput == null) { - throw new ArgumentNullException("exceedanceProbabilityCalculationInput", "Calculation input should be set."); + throw new ArgumentNullException("hydraRingCalculationInput", @"Calculation input should be set."); } - if (handleCalculationOutputAction == null) + if (action == null) { - throw new ArgumentNullException("handleCalculationOutputAction", "Handle calculation output action should be set."); + throw new ArgumentNullException("action", @"Handle calculation output action should be set."); } - - return new ExceedanceProbabilityCalculationActivity(name, hlcdDirectory, ringId, timeIntegrationSchemeType, uncertaintiesType, exceedanceProbabilityCalculationInput, handleCalculationOutputAction, hydraRingCalculationService); } } } \ No newline at end of file Index: Ringtoets/HydraRing/src/Ringtoets.HydraRing.Calculation/Data/HydraRingSection.cs =================================================================== diff -u -rc3195f7a1668f7479989ed59de1198b53bc80d8a -rdec46d5efaad5332ffb2a96e67ec11209ddc5515 --- Ringtoets/HydraRing/src/Ringtoets.HydraRing.Calculation/Data/HydraRingSection.cs (.../HydraRingSection.cs) (revision c3195f7a1668f7479989ed59de1198b53bc80d8a) +++ Ringtoets/HydraRing/src/Ringtoets.HydraRing.Calculation/Data/HydraRingSection.cs (.../HydraRingSection.cs) (revision dec46d5efaad5332ffb2a96e67ec11209ddc5515) @@ -28,33 +28,21 @@ { private readonly int sectionId; private readonly string sectionName; - private readonly double sectionBeginCoordinate; - private readonly double sectionEndCoordinate; private readonly double sectionLength; - private readonly double crossSectionXCoordinate; - private readonly double crossSectionYCoordinate; private readonly double crossSectionNormal; /// /// Creates a new instance of the class. /// /// The id of the section. /// The name of the section. - /// The begin coordinate of the section. - /// The end coordinate of the section. /// The length of the section. - /// The x coordinate of the cross section. - /// the y coordinate of the cross section. /// The normal of the cross section. - public HydraRingSection(int sectionId, string sectionName, double sectionBeginCoordinate, double sectionEndCoordinate, double sectionLength, double crossSectionXCoordinate, double crossSectionYCoordinate, double crossSectionNormal) + public HydraRingSection(int sectionId, string sectionName, double sectionLength, double crossSectionNormal) { this.sectionId = sectionId; this.sectionName = sectionName; - this.sectionBeginCoordinate = sectionBeginCoordinate; - this.sectionEndCoordinate = sectionEndCoordinate; this.sectionLength = sectionLength; - this.crossSectionXCoordinate = crossSectionXCoordinate; - this.crossSectionYCoordinate = crossSectionYCoordinate; this.crossSectionNormal = crossSectionNormal; } @@ -84,34 +72,6 @@ } /// - /// Gets the begin coordinate of the section. - /// - /// - /// If only a cross section is considered, this property should be set equal to . - /// - public double SectionBeginCoordinate - { - get - { - return sectionBeginCoordinate; - } - } - - /// - /// Gets the end coordinate of the section. - /// - /// - /// If only a cross section is considered, this property should be set equal to . - /// - public double SectionEndCoordinate - { - get - { - return sectionEndCoordinate; - } - } - - /// /// Gets the length of the section. /// public double SectionLength @@ -123,28 +83,6 @@ } /// - /// Gets the x coordinate of the cross section. - /// - public double CrossSectionXCoordinate - { - get - { - return crossSectionXCoordinate; - } - } - - /// - /// Gets the y coordinate of the cross section. - /// - public double CrossSectionYCoordinate - { - get - { - return crossSectionYCoordinate; - } - } - - /// /// Gets the normal of the cross section. /// /// Index: Ringtoets/HydraRing/src/Ringtoets.HydraRing.Calculation/Data/Input/Hydraulics/AssessmentLevelCalculationInput.cs =================================================================== diff -u -r8b5a6f938fe2b04cd78623649df37580e145055f -rdec46d5efaad5332ffb2a96e67ec11209ddc5515 --- Ringtoets/HydraRing/src/Ringtoets.HydraRing.Calculation/Data/Input/Hydraulics/AssessmentLevelCalculationInput.cs (.../AssessmentLevelCalculationInput.cs) (revision 8b5a6f938fe2b04cd78623649df37580e145055f) +++ Ringtoets/HydraRing/src/Ringtoets.HydraRing.Calculation/Data/Input/Hydraulics/AssessmentLevelCalculationInput.cs (.../AssessmentLevelCalculationInput.cs) (revision dec46d5efaad5332ffb2a96e67ec11209ddc5515) @@ -37,7 +37,7 @@ /// The norm to use during the calculation. public AssessmentLevelCalculationInput(int hydraulicBoundaryLocationId, double norm) : base(hydraulicBoundaryLocationId, norm) { - section = new HydraRingSection(HydraulicBoundaryLocationId, HydraulicBoundaryLocationId.ToString(), double.NaN, double.NaN, double.NaN, double.NaN, double.NaN, double.NaN); + section = new HydraRingSection(HydraulicBoundaryLocationId, HydraulicBoundaryLocationId.ToString(), double.NaN, double.NaN); } public override HydraRingFailureMechanismType FailureMechanismType Index: Ringtoets/HydraRing/src/Ringtoets.HydraRing.Calculation/Services/HydraRingCalculationService.cs =================================================================== diff -u -r74f9fae7e26c7ba15c1ef5681c51acf842f76122 -rdec46d5efaad5332ffb2a96e67ec11209ddc5515 --- Ringtoets/HydraRing/src/Ringtoets.HydraRing.Calculation/Services/HydraRingCalculationService.cs (.../HydraRingCalculationService.cs) (revision 74f9fae7e26c7ba15c1ef5681c51acf842f76122) +++ Ringtoets/HydraRing/src/Ringtoets.HydraRing.Calculation/Services/HydraRingCalculationService.cs (.../HydraRingCalculationService.cs) (revision dec46d5efaad5332ffb2a96e67ec11209ddc5515) @@ -46,7 +46,10 @@ /// The to use while executing the calculation. /// The input of the calculation to perform. /// A on a successful calculation, null otherwise. - public virtual TargetProbabilityCalculationOutput PerformCalculation(string hlcdDirectory, string ringId, HydraRingTimeIntegrationSchemeType timeIntegrationSchemeType, HydraRingUncertaintiesType uncertaintiesType, TargetProbabilityCalculationInput targetProbabilityCalculationInput) + public virtual TargetProbabilityCalculationOutput PerformCalculation(string hlcdDirectory, string ringId, + HydraRingTimeIntegrationSchemeType timeIntegrationSchemeType, + HydraRingUncertaintiesType uncertaintiesType, + TargetProbabilityCalculationInput targetProbabilityCalculationInput) { return PerformCalculation(hlcdDirectory, ringId, timeIntegrationSchemeType, uncertaintiesType, targetProbabilityCalculationInput, (outputFilePath, outputDatabasePath) => @@ -64,7 +67,8 @@ /// The to use while executing the calculation. /// The input of the calculation to perform. /// A on a successful calculation, null otherwise. - public virtual ExceedanceProbabilityCalculationOutput PerformCalculation(string hlcdDirectory, string ringId, HydraRingTimeIntegrationSchemeType timeIntegrationSchemeType, + public virtual ExceedanceProbabilityCalculationOutput PerformCalculation(string hlcdDirectory, string ringId, + HydraRingTimeIntegrationSchemeType timeIntegrationSchemeType, HydraRingUncertaintiesType uncertaintiesType, ExceedanceProbabilityCalculationInput exceedanceProbabilityCalculationInput) { @@ -85,7 +89,9 @@ } } - private static T PerformCalculation(string hlcdDirectory, string ringId, HydraRingTimeIntegrationSchemeType timeIntegrationSchemeType, HydraRingUncertaintiesType uncertaintiesType, HydraRingCalculationInput hydraRingCalculationInput, Func parseFunction) + private static T PerformCalculation(string hlcdDirectory, string ringId, + HydraRingTimeIntegrationSchemeType timeIntegrationSchemeType, HydraRingUncertaintiesType uncertaintiesType, + HydraRingCalculationInput hydraRingCalculationInput, Func parseFunction) { var sectionId = hydraRingCalculationInput.Section.SectionId; Index: Ringtoets/HydraRing/src/Ringtoets.HydraRing.Calculation/Services/HydraRingConfigurationService.cs =================================================================== diff -u -r54c270e65b7ea51ec9855500fbc7cd9f5869fceb -rdec46d5efaad5332ffb2a96e67ec11209ddc5515 --- Ringtoets/HydraRing/src/Ringtoets.HydraRing.Calculation/Services/HydraRingConfigurationService.cs (.../HydraRingConfigurationService.cs) (revision 54c270e65b7ea51ec9855500fbc7cd9f5869fceb) +++ Ringtoets/HydraRing/src/Ringtoets.HydraRing.Calculation/Services/HydraRingConfigurationService.cs (.../HydraRingConfigurationService.cs) (revision dec46d5efaad5332ffb2a96e67ec11209ddc5515) @@ -204,16 +204,16 @@ "Description", hydraRingSection.SectionName // Just use the section name }, { - "RingCoordinateBegin", GetHydraRingValue(hydraRingSection.SectionBeginCoordinate) + "RingCoordinateBegin", defaultHydraRingValue // No support for coordinates }, { - "RingCoordinateEnd", GetHydraRingValue(hydraRingSection.SectionEndCoordinate) + "RingCoordinateEnd", defaultHydraRingValue // No support for coordinates }, { - "XCoordinate", GetHydraRingValue(hydraRingSection.CrossSectionXCoordinate) + "XCoordinate", defaultHydraRingValue // No support for coordinates }, { - "YCoordinate", GetHydraRingValue(hydraRingSection.CrossSectionYCoordinate) + "YCoordinate", defaultHydraRingValue // No support for coordinates }, { "StationId1", hydraRingCalculationInput.HydraulicBoundaryLocationId Index: Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/Activities/HydraRingActivityFactoryTest.cs =================================================================== diff -u -r74f9fae7e26c7ba15c1ef5681c51acf842f76122 -rdec46d5efaad5332ffb2a96e67ec11209ddc5515 --- Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/Activities/HydraRingActivityFactoryTest.cs (.../HydraRingActivityFactoryTest.cs) (revision 74f9fae7e26c7ba15c1ef5681c51acf842f76122) +++ Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/Activities/HydraRingActivityFactoryTest.cs (.../HydraRingActivityFactoryTest.cs) (revision dec46d5efaad5332ffb2a96e67ec11209ddc5515) @@ -35,7 +35,7 @@ #region ExceedanceProbabilityCalculationInput [Test] - public void Create_ExceedanceProbabilityCalculationEmptyName_ThrowsArgumentException() + public void CreateExceedanceProbabilityCalculationInput_InputEmptyName_ThrowsArgumentException() { // Setup var mocks = new MockRepository(); @@ -52,7 +52,7 @@ } [Test] - public void Create_ExceedanceProbabilityCalculationEmptyHlcdDirectory_ThrowsArgumentException() + public void CreateExceedanceProbabilityCalculationInput_InputEmptyHlcdDirectory_ThrowsArgumentException() { // Setup var mocks = new MockRepository(); @@ -69,7 +69,7 @@ } [Test] - public void Create_ExceedanceProbabilityCalculationEmptyRingId_ThrowsArgumentException() + public void CreateExceedanceProbabilityCalculationInput_InputEmptyRingId_ThrowsArgumentException() { // Setup var mocks = new MockRepository(); @@ -86,24 +86,38 @@ } [Test] - public void Create_ExceedanceProbabilityCalculationHandleCalculationOutputActionNull_ThrowsArgumentNullException() + public void CreateExceedanceProbabilityCalculationInput_InputHandleCalculationInputNull_ThrowsArgumentNullException() { // Setup var mocks = new MockRepository(); - var exceedanceProbabilityCalculationInput = mocks.StrictMock(1); + mocks.ReplayAll(); + // Call + TestDelegate test = () => HydraRingActivityFactory.Create("name", "hlcdDirectory", "ringId", HydraRingTimeIntegrationSchemeType.FBC, HydraRingUncertaintiesType.All, (ExceedanceProbabilityCalculationInput) null, output => { }); + + // Assert + var exception = Assert.Throws(test, "Calculation input should be set."); + Assert.AreEqual("hydraRingCalculationInput", exception.ParamName); + } + + [Test] + public void CreateExceedanceProbabilityCalculationInput_InputHandleCalculationOutputActionNull_ThrowsArgumentNullException() + { + // Setup + var mocks = new MockRepository(); + var exceedanceProbabilityCalculationInput = mocks.StrictMock(1); mocks.ReplayAll(); // Call TestDelegate test = () => HydraRingActivityFactory.Create("name", "hlcdDirectory", "ringId", HydraRingTimeIntegrationSchemeType.FBC, HydraRingUncertaintiesType.All, exceedanceProbabilityCalculationInput, null); // Assert var exception = Assert.Throws(test, "Handle calculation output action should be set."); - Assert.AreEqual("handleCalculationOutputAction", exception.ParamName); + Assert.AreEqual("action", exception.ParamName); } [Test] - public void Create_ExceedanceProbabilityCalculationValidParameters_ReturnsExpectedExceedanceProbabilityCalculationActivity() + public void CreateExceedanceProbabilityCalculationInput_CalculationInputValidParameters_ReturnsExpectedExceedanceProbabilityCalculationActivity() { // Setup var mocks = new MockRepository(); @@ -177,6 +191,22 @@ } [Test] + public void CreateTargetProbabilityCalculationInput_InputHandleCalculationInputNull_ThrowsArgumentNullException() + { + // Setup + var mocks = new MockRepository(); + + mocks.ReplayAll(); + + // Call + TestDelegate test = () => HydraRingActivityFactory.Create("name", "hlcdDirectory", "ringId", HydraRingTimeIntegrationSchemeType.FBC, HydraRingUncertaintiesType.All, (TargetProbabilityCalculationInput) null, output => { }); + + // Assert + var exception = Assert.Throws(test, "Calculation input should be set."); + Assert.AreEqual("hydraRingCalculationInput", exception.ParamName); + } + + [Test] public void CreateTargetProbabilityCalculationInput_InputHandleCalculationOutputActionNull_ThrowsArgumentNullException() { // Setup @@ -190,7 +220,7 @@ // Assert var exception = Assert.Throws(test, "Handle calculation output action should be set."); - Assert.AreEqual("handleCalculationOutputAction", exception.ParamName); + Assert.AreEqual("action", exception.ParamName); } [Test] Index: Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/Data/HydraRingSectionTest.cs =================================================================== diff -u -r8b5a6f938fe2b04cd78623649df37580e145055f -rdec46d5efaad5332ffb2a96e67ec11209ddc5515 --- Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/Data/HydraRingSectionTest.cs (.../HydraRingSectionTest.cs) (revision 8b5a6f938fe2b04cd78623649df37580e145055f) +++ Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/Data/HydraRingSectionTest.cs (.../HydraRingSectionTest.cs) (revision dec46d5efaad5332ffb2a96e67ec11209ddc5515) @@ -31,17 +31,13 @@ public void Constructor_ExpectedValues() { // Call - var hydraRingSection = new HydraRingSection(1, "Name", 2.2, 3.3, 4.4, 5.5, 6.6, 7.7); + var hydraRingSection = new HydraRingSection(1, "Name", 2.2, 3.3); // Assert Assert.AreEqual(1, hydraRingSection.SectionId); Assert.AreEqual("Name", hydraRingSection.SectionName); - Assert.AreEqual(2.2, hydraRingSection.SectionBeginCoordinate); - Assert.AreEqual(3.3, hydraRingSection.SectionEndCoordinate); - Assert.AreEqual(4.4, hydraRingSection.SectionLength); - Assert.AreEqual(5.5, hydraRingSection.CrossSectionXCoordinate); - Assert.AreEqual(6.6, hydraRingSection.CrossSectionYCoordinate); - Assert.AreEqual(7.7, hydraRingSection.CrossSectionNormal); + Assert.AreEqual(2.2, hydraRingSection.SectionLength); + Assert.AreEqual(3.3, hydraRingSection.CrossSectionNormal); } } } \ No newline at end of file Index: Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/Data/Input/ExceedanceProbabilityCalculationInputTest.cs =================================================================== diff -u -r54c270e65b7ea51ec9855500fbc7cd9f5869fceb -rdec46d5efaad5332ffb2a96e67ec11209ddc5515 --- Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/Data/Input/ExceedanceProbabilityCalculationInputTest.cs (.../ExceedanceProbabilityCalculationInputTest.cs) (revision 54c270e65b7ea51ec9855500fbc7cd9f5869fceb) +++ Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/Data/Input/ExceedanceProbabilityCalculationInputTest.cs (.../ExceedanceProbabilityCalculationInputTest.cs) (revision dec46d5efaad5332ffb2a96e67ec11209ddc5515) @@ -76,7 +76,7 @@ { get { - return new HydraRingSection(1, "Name", 2.2, 3.3, 4.4, 5.5, 6.6, 7.7); + return new HydraRingSection(1, "Name", 2.2, 3.3); } } } Index: Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/Data/Input/HydraRingCalculationInputTest.cs =================================================================== diff -u -r54c270e65b7ea51ec9855500fbc7cd9f5869fceb -rdec46d5efaad5332ffb2a96e67ec11209ddc5515 --- Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/Data/Input/HydraRingCalculationInputTest.cs (.../HydraRingCalculationInputTest.cs) (revision 54c270e65b7ea51ec9855500fbc7cd9f5869fceb) +++ Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/Data/Input/HydraRingCalculationInputTest.cs (.../HydraRingCalculationInputTest.cs) (revision dec46d5efaad5332ffb2a96e67ec11209ddc5515) @@ -91,7 +91,7 @@ { get { - return new HydraRingSection(1, "Name", 2.2, 3.3, 4.4, 5.5, 6.6, 7.7); + return new HydraRingSection(1, "Name", 2.2, 3.3); } } Index: Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/Data/Input/Hydraulics/AssessmentLevelCalculationInputTest.cs =================================================================== diff -u -r54c270e65b7ea51ec9855500fbc7cd9f5869fceb -rdec46d5efaad5332ffb2a96e67ec11209ddc5515 --- Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/Data/Input/Hydraulics/AssessmentLevelCalculationInputTest.cs (.../AssessmentLevelCalculationInputTest.cs) (revision 54c270e65b7ea51ec9855500fbc7cd9f5869fceb) +++ Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/Data/Input/Hydraulics/AssessmentLevelCalculationInputTest.cs (.../AssessmentLevelCalculationInputTest.cs) (revision dec46d5efaad5332ffb2a96e67ec11209ddc5515) @@ -53,11 +53,7 @@ var hydraRingSection = assessmentLevelCalculationInput.Section; Assert.AreEqual(1, hydraRingSection.SectionId); Assert.AreEqual("1", hydraRingSection.SectionName); - Assert.IsNaN(hydraRingSection.SectionBeginCoordinate); - Assert.IsNaN(hydraRingSection.SectionEndCoordinate); Assert.IsNaN(hydraRingSection.SectionLength); - Assert.IsNaN(hydraRingSection.CrossSectionXCoordinate); - Assert.IsNaN(hydraRingSection.CrossSectionYCoordinate); Assert.IsNaN(hydraRingSection.CrossSectionNormal); var assessmentLevelVariable = assessmentLevelCalculationInput.Variables.First(); Index: Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/Data/Input/Overtopping/OvertoppingCalculationInputTest.cs =================================================================== diff -u -re3912b8e6d94f1d0e9c765ba8ec18ed29e8484db -rdec46d5efaad5332ffb2a96e67ec11209ddc5515 --- Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/Data/Input/Overtopping/OvertoppingCalculationInputTest.cs (.../OvertoppingCalculationInputTest.cs) (revision e3912b8e6d94f1d0e9c765ba8ec18ed29e8484db) +++ Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/Data/Input/Overtopping/OvertoppingCalculationInputTest.cs (.../OvertoppingCalculationInputTest.cs) (revision dec46d5efaad5332ffb2a96e67ec11209ddc5515) @@ -37,7 +37,7 @@ const int expectedCalculationTypeId = 1; const int expectedVariableId = 1; int hydraulicBoundaryLocationId = 1000; - HydraRingSection expectedHydraRingSection = new HydraRingSection(expectedVariableId, "1000", double.NaN, double.NaN, double.NaN, double.NaN, double.NaN, double.NaN); + HydraRingSection expectedHydraRingSection = new HydraRingSection(expectedVariableId, "1000", double.NaN, double.NaN); const double dikeHeight = 11.11; const double modelFactorCriticalOvertopping = 1; @@ -94,7 +94,7 @@ public void GetSubMechanismModelId_Always_ReturnsExpectedValues(int subMechanismModelId, int? expectedSubMechanismModelId) { // Setup - HydraRingSection hydraRingSection = new HydraRingSection(1, "1000", double.NaN, double.NaN, double.NaN, double.NaN, double.NaN, double.NaN); + HydraRingSection hydraRingSection = new HydraRingSection(1, "1000", double.NaN, double.NaN); // Call OvertoppingCalculationInput overtoppingCalculationInput = new OvertoppingCalculationInput(1, hydraRingSection, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, Index: Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/Data/Input/TargetProbabilityCalculationInputTest.cs =================================================================== diff -u -r54c270e65b7ea51ec9855500fbc7cd9f5869fceb -rdec46d5efaad5332ffb2a96e67ec11209ddc5515 --- Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/Data/Input/TargetProbabilityCalculationInputTest.cs (.../TargetProbabilityCalculationInputTest.cs) (revision 54c270e65b7ea51ec9855500fbc7cd9f5869fceb) +++ Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/Data/Input/TargetProbabilityCalculationInputTest.cs (.../TargetProbabilityCalculationInputTest.cs) (revision dec46d5efaad5332ffb2a96e67ec11209ddc5515) @@ -74,7 +74,7 @@ { get { - return new HydraRingSection(1, "Name", 2.2, 3.3, 4.4, 5.5, 6.6, 7.7); + return new HydraRingSection(1, "Name", 2.2, 3.3); } } } Index: Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/Integration/HydraRingConfigurationServiceIntegrationTest.cs =================================================================== diff -u -re3912b8e6d94f1d0e9c765ba8ec18ed29e8484db -rdec46d5efaad5332ffb2a96e67ec11209ddc5515 --- Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/Integration/HydraRingConfigurationServiceIntegrationTest.cs (.../HydraRingConfigurationServiceIntegrationTest.cs) (revision e3912b8e6d94f1d0e9c765ba8ec18ed29e8484db) +++ Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/Integration/HydraRingConfigurationServiceIntegrationTest.cs (.../HydraRingConfigurationServiceIntegrationTest.cs) (revision dec46d5efaad5332ffb2a96e67ec11209ddc5515) @@ -102,12 +102,11 @@ [Test] public void GenerateDataBaseCreationScript_HydraRingConfigurationWithOvertoppingCalculation_ReturnsExpectedCreationScript() { - // Setup var hydraRingConfigurationService = new HydraRingConfigurationService("34-1", HydraRingTimeIntegrationSchemeType.FBC, HydraRingUncertaintiesType.All); int hydraulicBoundaryLocationId = 700004; - var hydraRingSection = new HydraRingSection(hydraulicBoundaryLocationId, "700004", 2.2, 3.3, 4.4, 5.5, 6.6, 7.7); + var hydraRingSection = new HydraRingSection(hydraulicBoundaryLocationId, "700004", 2.2, 3.3); const double dikeHeight = 11.11; const double modelFactorCriticalOvertopping = 1; const double factorFnMean = 4.75; @@ -133,16 +132,16 @@ hydraRingConfigurationService.AddHydraRingCalculationInput(new OvertoppingCalculationInput(hydraulicBoundaryLocationId, hydraRingSection, dikeHeight, - modelFactorCriticalOvertopping, factorFnMean, factorFnStandardDeviation, hydraRingFactorFnMean, hydraRingFactorFnStandardDeviation, - hydraRingmodelFactorOvertopping, criticalOvertoppingMean, criticalOvertoppingStandardDeviation, hydraRingModelFactorFrunupMean, - hydraRingModelFactorFrunupStandardDeviation, hydraRingExponentModelFactorShallowMean, hydraRingExponentModelFactorShallowStandardDeviation + modelFactorCriticalOvertopping, factorFnMean, factorFnStandardDeviation, hydraRingFactorFnMean, hydraRingFactorFnStandardDeviation, + hydraRingmodelFactorOvertopping, criticalOvertoppingMean, criticalOvertoppingStandardDeviation, hydraRingModelFactorFrunupMean, + hydraRingModelFactorFrunupStandardDeviation, hydraRingExponentModelFactorShallowMean, hydraRingExponentModelFactorShallowStandardDeviation , profilePoints, forelandPoints, breakWater)); var expectedCreationScript = "DELETE FROM [HydraulicModels];" + Environment.NewLine + "INSERT INTO [HydraulicModels] VALUES (1, 1, 'WTI 2017');" + Environment.NewLine + Environment.NewLine + "DELETE FROM [Sections];" + Environment.NewLine + - "INSERT INTO [Sections] VALUES (700004, 1, 1, '700004', '700004', 2.2, 3.3, 5.5, 6.6, 700004, 700004, 100, 7.7, 4.4);" + Environment.NewLine + + "INSERT INTO [Sections] VALUES (700004, 1, 1, '700004', '700004', 0, 0, 0, 0, 700004, 700004, 100, 3.3, 2.2);" + Environment.NewLine + Environment.NewLine + "DELETE FROM [DesignTables];" + Environment.NewLine + "INSERT INTO [DesignTables] VALUES (700004, 101, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0);" + Environment.NewLine + @@ -209,7 +208,6 @@ // Assert Assert.AreEqual(expectedCreationScript, creationScript); - } } } \ No newline at end of file Index: Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/Services/HydraRingCalculationServiceTest.cs =================================================================== diff -u -re3912b8e6d94f1d0e9c765ba8ec18ed29e8484db -rdec46d5efaad5332ffb2a96e67ec11209ddc5515 --- Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/Services/HydraRingCalculationServiceTest.cs (.../HydraRingCalculationServiceTest.cs) (revision e3912b8e6d94f1d0e9c765ba8ec18ed29e8484db) +++ Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/Services/HydraRingCalculationServiceTest.cs (.../HydraRingCalculationServiceTest.cs) (revision dec46d5efaad5332ffb2a96e67ec11209ddc5515) @@ -76,7 +76,7 @@ var hlcdDirectory = "Invalid HLCD directory"; var hydraRingCalculationService = new HydraRingCalculationService(); var incorrectStationId = 999; - var hydraRingSection = new HydraRingSection(incorrectStationId, "999", 0.0, 0.0, 0.0, 0.0, 0.0, 0.0); + var hydraRingSection = new HydraRingSection(incorrectStationId, "999", 0.0, 0.0); var mockRepository = new MockRepository(); var hydraRingBreakWaterMock = mockRepository.StrictMock(0, 1.1); Index: Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/Services/HydraRingConfigurationServiceTest.cs =================================================================== diff -u -r54c270e65b7ea51ec9855500fbc7cd9f5869fceb -rdec46d5efaad5332ffb2a96e67ec11209ddc5515 --- Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/Services/HydraRingConfigurationServiceTest.cs (.../HydraRingConfigurationServiceTest.cs) (revision 54c270e65b7ea51ec9855500fbc7cd9f5869fceb) +++ Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/Services/HydraRingConfigurationServiceTest.cs (.../HydraRingConfigurationServiceTest.cs) (revision dec46d5efaad5332ffb2a96e67ec11209ddc5515) @@ -55,7 +55,7 @@ "INSERT INTO [HydraulicModels] VALUES (3, 2, 'WTI 2017');" + Environment.NewLine + Environment.NewLine + "DELETE FROM [Sections];" + Environment.NewLine + - "INSERT INTO [Sections] VALUES (1, 1, 1, 'LocationName', 'LocationName', 2.2, 3.3, 5.5, 6.6, 700004, 700004, 100, 7.7, 4.4);" + Environment.NewLine + + "INSERT INTO [Sections] VALUES (1, 1, 1, 'LocationName', 'LocationName', 0, 0, 0, 0, 700004, 700004, 100, 3.3, 2.2);" + Environment.NewLine + Environment.NewLine + "DELETE FROM [DesignTables];" + Environment.NewLine + "INSERT INTO [DesignTables] VALUES (1, 1, 1, 1, 4, 5, 0, 0, 0, 0, 5, 15, 1.1);" + Environment.NewLine + @@ -137,9 +137,9 @@ "INSERT INTO [HydraulicModels] VALUES (3, 2, 'WTI 2017');" + Environment.NewLine + Environment.NewLine + "DELETE FROM [Sections];" + Environment.NewLine + - "INSERT INTO [Sections] VALUES (1, 1, 1, 'LocationName', 'LocationName', 2.2, 3.3, 5.5, 6.6, 700004, 700004, 100, 7.7, 4.4);" + Environment.NewLine + - "INSERT INTO [Sections] VALUES (2, 1, 1, 'LocationName', 'LocationName', 2.2, 3.3, 5.5, 6.6, 700005, 700005, 100, 7.7, 4.4);" + Environment.NewLine + - "INSERT INTO [Sections] VALUES (3, 1, 1, 'LocationName', 'LocationName', 2.2, 3.3, 5.5, 6.6, 700006, 700006, 100, 7.7, 4.4);" + Environment.NewLine + + "INSERT INTO [Sections] VALUES (1, 1, 1, 'LocationName', 'LocationName', 0, 0, 0, 0, 700004, 700004, 100, 3.3, 2.2);" + Environment.NewLine + + "INSERT INTO [Sections] VALUES (2, 1, 1, 'LocationName', 'LocationName', 0, 0, 0, 0, 700005, 700005, 100, 3.3, 2.2);" + Environment.NewLine + + "INSERT INTO [Sections] VALUES (3, 1, 1, 'LocationName', 'LocationName', 0, 0, 0, 0, 700006, 700006, 100, 3.3, 2.2);" + Environment.NewLine + Environment.NewLine + "DELETE FROM [DesignTables];" + Environment.NewLine + "INSERT INTO [DesignTables] VALUES (1, 1, 1, 1, 4, 5, 0, 0, 0, 0, 5, 15, 1.1);" + Environment.NewLine + @@ -278,7 +278,7 @@ { get { - return new HydraRingSection(sectionId, "LocationName", 2.2, 3.3, 4.4, 5.5, 6.6, 7.7); + return new HydraRingSection(sectionId, "LocationName", 2.2, 3.3); } }