Index: Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Data.Test/GrassCoverErosionOutwardsFailureMechanismExtensionsTest.cs =================================================================== diff -u -rdca3bade3670653a7d1eed349616861e7adee605 -r60492438211c9d4fac85939a13f47f4890d9aaf2 --- Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Data.Test/GrassCoverErosionOutwardsFailureMechanismExtensionsTest.cs (.../GrassCoverErosionOutwardsFailureMechanismExtensionsTest.cs) (revision dca3bade3670653a7d1eed349616861e7adee605) +++ Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Data.Test/GrassCoverErosionOutwardsFailureMechanismExtensionsTest.cs (.../GrassCoverErosionOutwardsFailureMechanismExtensionsTest.cs) (revision 60492438211c9d4fac85939a13f47f4890d9aaf2) @@ -144,8 +144,8 @@ [Test] [TestCaseSource( - typeof(GrassCoverErosionOutwardsAssessmentSectionHelper), - nameof(GrassCoverErosionOutwardsAssessmentSectionHelper.GetHydraulicBoundaryLocationCalculationConfigurationPerFailureMechanismCategoryType))] + typeof(GrassCoverErosionOutwardsAssessmentSectionTestHelper), + nameof(GrassCoverErosionOutwardsAssessmentSectionTestHelper.GetHydraulicBoundaryLocationCalculationConfigurationPerFailureMechanismCategoryType))] public void GetAssessmentLevel_HydraulicBoundaryLocationWithOutput_ReturnsCorrespondingAssessmentLevel( IAssessmentSection assessmentSection, GrassCoverErosionOutwardsFailureMechanism failureMechanism, @@ -250,8 +250,8 @@ [Test] [TestCaseSource( - typeof(GrassCoverErosionOutwardsAssessmentSectionHelper), - nameof(GrassCoverErosionOutwardsAssessmentSectionHelper.GetHydraulicBoundaryLocationCalculationConfigurationPerFailureMechanismCategoryType))] + typeof(GrassCoverErosionOutwardsAssessmentSectionTestHelper), + nameof(GrassCoverErosionOutwardsAssessmentSectionTestHelper.GetHydraulicBoundaryLocationCalculationConfigurationPerFailureMechanismCategoryType))] public void GetHydraulicBoundaryLocationCalculation_HydraulicBoundaryLocationWithOutput_ReturnsCorrespondingHydraulicBoundaryLocationCalculation( IAssessmentSection assessmentSection, GrassCoverErosionOutwardsFailureMechanism failureMechanism, Fisheye: Tag 60492438211c9d4fac85939a13f47f4890d9aaf2 refers to a dead (removed) revision in file `Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Data.TestUtil.Test/GrassCoverErosionOutwardsAssessmentSectionHelperTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Data.TestUtil.Test/GrassCoverErosionOutwardsAssessmentSectionTestHelperTest.cs =================================================================== diff -u --- Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Data.TestUtil.Test/GrassCoverErosionOutwardsAssessmentSectionTestHelperTest.cs (revision 0) +++ Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Data.TestUtil.Test/GrassCoverErosionOutwardsAssessmentSectionTestHelperTest.cs (revision 60492438211c9d4fac85939a13f47f4890d9aaf2) @@ -0,0 +1,83 @@ +// Copyright (C) Stichting Deltares 2017. 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 System.Collections.Generic; +using System.Linq; +using NUnit.Framework; +using Ringtoets.Common.Data.AssessmentSection; +using Ringtoets.Common.Data.FailureMechanism; +using Ringtoets.Common.Data.Hydraulics; + +namespace Ringtoets.GrassCoverErosionOutwards.Data.TestUtil.Test +{ + [TestFixture] + public class GrassCoverErosionOutwardsAssessmentSectionTestHelperTest + { + [Test] + public void GetHydraulicBoundaryLocationCalculationConfigurationPerFailureMechanismCategoryType_Always_ReturnsExpectedTestCaseDataCollection() + { + // Call + TestCaseData[] testCaseDataCollection = GrassCoverErosionOutwardsAssessmentSectionTestHelper.GetHydraulicBoundaryLocationCalculationConfigurationPerFailureMechanismCategoryType().ToArray(); + + // Assert + AssertTestCaseData(testCaseDataCollection, + "MechanismSpecificFactorizedSignalingNorm", + FailureMechanismCategoryType.MechanismSpecificFactorizedSignalingNorm, + (a, fm) => fm.WaterLevelCalculationsForMechanismSpecificFactorizedSignalingNorm); + AssertTestCaseData(testCaseDataCollection, + "MechanismSpecificSignalingNorm", + FailureMechanismCategoryType.MechanismSpecificSignalingNorm, + (a, fm) => fm.WaterLevelCalculationsForMechanismSpecificSignalingNorm); + AssertTestCaseData(testCaseDataCollection, + "MechanismSpecificLowerLimitNorm", + FailureMechanismCategoryType.MechanismSpecificLowerLimitNorm, + (a, fm) => fm.WaterLevelCalculationsForMechanismSpecificLowerLimitNorm); + AssertTestCaseData(testCaseDataCollection, + "LowerLimitNorm", + FailureMechanismCategoryType.LowerLimitNorm, + (a, fm) => a.WaterLevelCalculationsForLowerLimitNorm); + AssertTestCaseData(testCaseDataCollection, + "FactorizedLowerLimitNorm", + FailureMechanismCategoryType.FactorizedLowerLimitNorm, + (a, fm) => a.WaterLevelCalculationsForFactorizedLowerLimitNorm); + } + + private static void AssertTestCaseData(IEnumerable testCaseDataCollection, + string expectedTestName, + FailureMechanismCategoryType categoryType, + Func> getCalculationsFunc) + { + TestCaseData testCaseData = testCaseDataCollection.Single(td => categoryType.Equals(td.Arguments.ElementAt(3))); + + Assert.AreEqual(expectedTestName, testCaseData.TestName); + + var assessmentSection = (IAssessmentSection) testCaseData.Arguments.ElementAt(0); + var failureMechanism = (GrassCoverErosionOutwardsFailureMechanism) testCaseData.Arguments.ElementAt(1); + var hydraulicBoundaryLocation = (HydraulicBoundaryLocation) testCaseData.Arguments.ElementAt(2); + var hydraulicBoundaryLocationCalculation = (HydraulicBoundaryLocationCalculation) testCaseData.Arguments.ElementAt(4); + + HydraulicBoundaryLocationCalculation expectedHydraulicBoundaryLocationCalculation = getCalculationsFunc(assessmentSection, failureMechanism) + .First(c => ReferenceEquals(c.HydraulicBoundaryLocation, hydraulicBoundaryLocation)); + Assert.AreSame(expectedHydraulicBoundaryLocationCalculation, hydraulicBoundaryLocationCalculation); + } + } +} \ No newline at end of file Index: Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Data.TestUtil.Test/Ringtoets.GrassCoverErosionOutwards.Data.TestUtil.Test.csproj =================================================================== diff -u -r3591f8fe0d406ebcf4a263587196da26b5d444a5 -r60492438211c9d4fac85939a13f47f4890d9aaf2 --- Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Data.TestUtil.Test/Ringtoets.GrassCoverErosionOutwards.Data.TestUtil.Test.csproj (.../Ringtoets.GrassCoverErosionOutwards.Data.TestUtil.Test.csproj) (revision 3591f8fe0d406ebcf4a263587196da26b5d444a5) +++ Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Data.TestUtil.Test/Ringtoets.GrassCoverErosionOutwards.Data.TestUtil.Test.csproj (.../Ringtoets.GrassCoverErosionOutwards.Data.TestUtil.Test.csproj) (revision 60492438211c9d4fac85939a13f47f4890d9aaf2) @@ -14,7 +14,7 @@ - + Fisheye: Tag 60492438211c9d4fac85939a13f47f4890d9aaf2 refers to a dead (removed) revision in file `Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Data.TestUtil/GrassCoverErosionOutwardsAssessmentSectionHelper.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Data.TestUtil/GrassCoverErosionOutwardsAssessmentSectionTestHelper.cs =================================================================== diff -u --- Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Data.TestUtil/GrassCoverErosionOutwardsAssessmentSectionTestHelper.cs (revision 0) +++ Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Data.TestUtil/GrassCoverErosionOutwardsAssessmentSectionTestHelper.cs (revision 60492438211c9d4fac85939a13f47f4890d9aaf2) @@ -0,0 +1,106 @@ +// Copyright (C) Stichting Deltares 2017. 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.Collections.Generic; +using System.Linq; +using NUnit.Framework; +using Ringtoets.Common.Data.FailureMechanism; +using Ringtoets.Common.Data.TestUtil; + +namespace Ringtoets.GrassCoverErosionOutwards.Data.TestUtil +{ + /// + /// Helper class for creating assessment sections that can be used for unit tests + /// related to the grass cover erosion outwards failure mechanism. + /// + public static class GrassCoverErosionOutwardsAssessmentSectionTestHelper + { + /// + /// Gets a collection of containing a hydraulic boundary location calculation + /// configuration for all types of . + /// + /// A collection of , in which each item contains: + /// + /// the configured assessment section; + /// the configured ; + /// the hydraulic boundary location for which the hydraulic boundary location calculation output has been set; + /// the category type at stake; + /// the expected hydraulic boundary location calculation given the combination + /// of the before-mentioned assessment section, failure mechanism, hydraulic boundary location and + /// category type. + /// + /// + public static IEnumerable GetHydraulicBoundaryLocationCalculationConfigurationPerFailureMechanismCategoryType() + { + var assessmentSection = new AssessmentSectionStub(); + var hydraulicBoundaryLocation = new TestHydraulicBoundaryLocation(); + var failureMechanism = new GrassCoverErosionOutwardsFailureMechanism(); + + GrassCoverErosionOutwardsHydraulicBoundaryLocationsTestHelper.SetHydraulicBoundaryLocations( + failureMechanism, + assessmentSection, + new[] + { + hydraulicBoundaryLocation + }, true); + + yield return new TestCaseData( + assessmentSection, + failureMechanism, + hydraulicBoundaryLocation, + FailureMechanismCategoryType.MechanismSpecificFactorizedSignalingNorm, + failureMechanism.WaterLevelCalculationsForMechanismSpecificFactorizedSignalingNorm.ElementAt(0) + ).SetName("MechanismSpecificFactorizedSignalingNorm"); + + yield return new TestCaseData( + assessmentSection, + failureMechanism, + hydraulicBoundaryLocation, + FailureMechanismCategoryType.MechanismSpecificSignalingNorm, + failureMechanism.WaterLevelCalculationsForMechanismSpecificSignalingNorm.ElementAt(0) + ).SetName("MechanismSpecificSignalingNorm"); + + yield return new TestCaseData( + assessmentSection, + failureMechanism, + hydraulicBoundaryLocation, + FailureMechanismCategoryType.MechanismSpecificLowerLimitNorm, + failureMechanism.WaterLevelCalculationsForMechanismSpecificLowerLimitNorm.ElementAt(0) + ).SetName("MechanismSpecificLowerLimitNorm"); + + yield return new TestCaseData( + assessmentSection, + failureMechanism, + hydraulicBoundaryLocation, + FailureMechanismCategoryType.LowerLimitNorm, + assessmentSection.WaterLevelCalculationsForLowerLimitNorm.ElementAt(0) + ).SetName("LowerLimitNorm"); + + yield return new TestCaseData( + assessmentSection, + failureMechanism, + hydraulicBoundaryLocation, + FailureMechanismCategoryType.FactorizedLowerLimitNorm, + assessmentSection.WaterLevelCalculationsForFactorizedLowerLimitNorm.ElementAt(0) + ).SetName("FactorizedLowerLimitNorm"); + } + } +} \ No newline at end of file Index: Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Data.TestUtil/Ringtoets.GrassCoverErosionOutwards.Data.TestUtil.csproj =================================================================== diff -u -re3b58f9f74ce55c3334ca41ba325a7e5ff94052a -r60492438211c9d4fac85939a13f47f4890d9aaf2 --- Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Data.TestUtil/Ringtoets.GrassCoverErosionOutwards.Data.TestUtil.csproj (.../Ringtoets.GrassCoverErosionOutwards.Data.TestUtil.csproj) (revision e3b58f9f74ce55c3334ca41ba325a7e5ff94052a) +++ Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Data.TestUtil/Ringtoets.GrassCoverErosionOutwards.Data.TestUtil.csproj (.../Ringtoets.GrassCoverErosionOutwards.Data.TestUtil.csproj) (revision 60492438211c9d4fac85939a13f47f4890d9aaf2) @@ -15,7 +15,7 @@ - + Index: Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Plugin.Test/PropertyInfos/GrassCoverErosionOutwardsWaveConditionsInputContextPropertyInfoTest.cs =================================================================== diff -u -r0eddea1a45f0d9efb0a2a12e90eb99e814d1becb -r60492438211c9d4fac85939a13f47f4890d9aaf2 --- Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Plugin.Test/PropertyInfos/GrassCoverErosionOutwardsWaveConditionsInputContextPropertyInfoTest.cs (.../GrassCoverErosionOutwardsWaveConditionsInputContextPropertyInfoTest.cs) (revision 0eddea1a45f0d9efb0a2a12e90eb99e814d1becb) +++ Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Plugin.Test/PropertyInfos/GrassCoverErosionOutwardsWaveConditionsInputContextPropertyInfoTest.cs (.../GrassCoverErosionOutwardsWaveConditionsInputContextPropertyInfoTest.cs) (revision 60492438211c9d4fac85939a13f47f4890d9aaf2) @@ -53,8 +53,8 @@ [Test] [TestCaseSource( - typeof(GrassCoverErosionOutwardsAssessmentSectionHelper), - nameof(GrassCoverErosionOutwardsAssessmentSectionHelper.GetHydraulicBoundaryLocationCalculationConfigurationPerFailureMechanismCategoryType))] + typeof(GrassCoverErosionOutwardsAssessmentSectionTestHelper), + nameof(GrassCoverErosionOutwardsAssessmentSectionTestHelper.GetHydraulicBoundaryLocationCalculationConfigurationPerFailureMechanismCategoryType))] public void CreateInstance_WithContextThatHasInputWithSpecificCategoryType_ExpectedProperties( IAssessmentSection assessmentSection, GrassCoverErosionOutwardsFailureMechanism failureMechanism, Index: Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Plugin.Test/ViewInfos/GrassCoverErosionOutwardsWaveConditionsInputViewInfoTest.cs =================================================================== diff -u -redf66e01eb405ea1693646bd32d0139b29b356f4 -r60492438211c9d4fac85939a13f47f4890d9aaf2 --- Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Plugin.Test/ViewInfos/GrassCoverErosionOutwardsWaveConditionsInputViewInfoTest.cs (.../GrassCoverErosionOutwardsWaveConditionsInputViewInfoTest.cs) (revision edf66e01eb405ea1693646bd32d0139b29b356f4) +++ Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Plugin.Test/ViewInfos/GrassCoverErosionOutwardsWaveConditionsInputViewInfoTest.cs (.../GrassCoverErosionOutwardsWaveConditionsInputViewInfoTest.cs) (revision 60492438211c9d4fac85939a13f47f4890d9aaf2) @@ -125,8 +125,8 @@ [Test] [TestCaseSource( - typeof(GrassCoverErosionOutwardsAssessmentSectionHelper), - nameof(GrassCoverErosionOutwardsAssessmentSectionHelper.GetHydraulicBoundaryLocationCalculationConfigurationPerFailureMechanismCategoryType))] + typeof(GrassCoverErosionOutwardsAssessmentSectionTestHelper), + nameof(GrassCoverErosionOutwardsAssessmentSectionTestHelper.GetHydraulicBoundaryLocationCalculationConfigurationPerFailureMechanismCategoryType))] public void CreateInstance_GrassCoverErosionOutwardsWaveConditionsInputContext_ReturnViewWithCorrespondingAssessmentLevel( AssessmentSectionStub assessmentSection, GrassCoverErosionOutwardsFailureMechanism failureMechanism,