Index: Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Plugin.Test/PropertyInfos/GrassCoverErosionOutwardsWaveConditionsInputContextPropertyInfoTest.cs =================================================================== diff -u -rcdc0b636945b1939763c78df1e55e3f207f42a94 -r026939d282e7281edebc62e49794d9648e574382 --- Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Plugin.Test/PropertyInfos/GrassCoverErosionOutwardsWaveConditionsInputContextPropertyInfoTest.cs (.../GrassCoverErosionOutwardsWaveConditionsInputContextPropertyInfoTest.cs) (revision cdc0b636945b1939763c78df1e55e3f207f42a94) +++ Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Plugin.Test/PropertyInfos/GrassCoverErosionOutwardsWaveConditionsInputContextPropertyInfoTest.cs (.../GrassCoverErosionOutwardsWaveConditionsInputContextPropertyInfoTest.cs) (revision 026939d282e7281edebc62e49794d9648e574382) @@ -23,6 +23,7 @@ using Core.Common.Gui.Plugin; using Core.Common.Gui.PropertyBag; using NUnit.Framework; +using Ringtoets.Common.Data.Contribution; using Ringtoets.Common.Data.TestUtil; using Ringtoets.GrassCoverErosionOutwards.Data; using Ringtoets.GrassCoverErosionOutwards.Forms.PresentationObjects; @@ -48,19 +49,46 @@ } } - [Test] - public void CreateInstance_Always_SetsFailureMechanismAsData() + [TestCase(NormType.Signaling)] + [TestCase(NormType.LowerLimit)] + public void CreateInstance_Always_ExpectedProperties(NormType normType) { // Setup + const double designWaterLevelSignaling = 1.1; + const double designWaterLevelLowerLimit = 2.2; + var failureMechanism = new GrassCoverErosionOutwardsFailureMechanism(); - var calculation = new GrassCoverErosionOutwardsWaveConditionsCalculation(); - var assessmentSection = new ObservableTestAssessmentSectionStub(); - var context = new GrassCoverErosionOutwardsWaveConditionsInputContext( - calculation.InputParameters, - calculation, - assessmentSection, - failureMechanism); + var testHydraulicBoundaryLocation = new TestHydraulicBoundaryLocation + { + DesignWaterLevelCalculation2 = + { + Output = new TestHydraulicBoundaryLocationOutput(designWaterLevelSignaling) + }, + DesignWaterLevelCalculation3 = + { + Output = new TestHydraulicBoundaryLocationOutput(designWaterLevelLowerLimit) + } + }; + var calculation = new GrassCoverErosionOutwardsWaveConditionsCalculation + { + InputParameters = + { + HydraulicBoundaryLocation = testHydraulicBoundaryLocation + } + }; + var assessmentSection = new ObservableTestAssessmentSectionStub + { + FailureMechanismContribution = + { + NormativeNorm = normType + } + }; + var context = new GrassCoverErosionOutwardsWaveConditionsInputContext(calculation.InputParameters, + calculation, + assessmentSection, + failureMechanism); + using (var plugin = new GrassCoverErosionOutwardsPlugin()) { PropertyInfo info = GetInfo(plugin); @@ -71,6 +99,11 @@ // Assert Assert.IsInstanceOf(objectProperties); Assert.AreSame(context, objectProperties.Data); + + double expectedAssessmentLevel = normType == NormType.Signaling + ? designWaterLevelSignaling + : designWaterLevelLowerLimit; + Assert.AreEqual(expectedAssessmentLevel, ((GrassCoverErosionOutwardsWaveConditionsInputContextProperties) objectProperties).AssessmentLevel); } } Index: Ringtoets/StabilityStoneCover/test/Ringtoets.StabilityStoneCover.Plugin.Test/PropertyInfos/StabilityStoneCoverWaveConditionsInputContextPropertyInfoTest.cs =================================================================== diff -u --- Ringtoets/StabilityStoneCover/test/Ringtoets.StabilityStoneCover.Plugin.Test/PropertyInfos/StabilityStoneCoverWaveConditionsInputContextPropertyInfoTest.cs (revision 0) +++ Ringtoets/StabilityStoneCover/test/Ringtoets.StabilityStoneCover.Plugin.Test/PropertyInfos/StabilityStoneCoverWaveConditionsInputContextPropertyInfoTest.cs (revision 026939d282e7281edebc62e49794d9648e574382) @@ -0,0 +1,115 @@ +// 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.Linq; +using Core.Common.Gui.Plugin; +using Core.Common.Gui.PropertyBag; +using NUnit.Framework; +using Ringtoets.Common.Data.Contribution; +using Ringtoets.Common.Data.DikeProfiles; +using Ringtoets.Common.Data.TestUtil; +using Ringtoets.StabilityStoneCover.Data; +using Ringtoets.StabilityStoneCover.Forms.PresentationObjects; +using Ringtoets.StabilityStoneCover.Forms.PropertyClasses; + +namespace Ringtoets.StabilityStoneCover.Plugin.Test.PropertyInfos +{ + [TestFixture] + public class StabilityStoneCoverWaveConditionsInputContextPropertyInfoTest + { + [Test] + public void Initialized_Always_ExpectedPropertiesSet() + { + // Setup + using (var plugin = new StabilityStoneCoverPlugin()) + { + // Call + PropertyInfo info = GetInfo(plugin); + + // Assert + Assert.AreEqual(typeof(StabilityStoneCoverWaveConditionsInputContext), info.DataType); + Assert.AreEqual(typeof(StabilityStoneCoverWaveConditionsInputContextProperties), info.PropertyObjectType); + } + } + + [TestCase(NormType.Signaling)] + [TestCase(NormType.LowerLimit)] + public void CreateInstance_Always_ExpectedProperties(NormType normType) + { + // Setup + const double designWaterLevelSignaling = 1.1; + const double designWaterLevelLowerLimit = 2.2; + + var testHydraulicBoundaryLocation = new TestHydraulicBoundaryLocation + { + DesignWaterLevelCalculation2 = + { + Output = new TestHydraulicBoundaryLocationOutput(designWaterLevelSignaling) + }, + DesignWaterLevelCalculation3 = + { + Output = new TestHydraulicBoundaryLocationOutput(designWaterLevelLowerLimit) + } + }; + var calculation = new StabilityStoneCoverWaveConditionsCalculation + { + InputParameters = + { + HydraulicBoundaryLocation = testHydraulicBoundaryLocation + } + }; + var assessmentSection = new ObservableTestAssessmentSectionStub + { + FailureMechanismContribution = + { + NormativeNorm = normType + } + }; + + var context = new StabilityStoneCoverWaveConditionsInputContext(calculation.InputParameters, + calculation, + assessmentSection, + new ForeshoreProfile[0]); + + using (var plugin = new StabilityStoneCoverPlugin()) + { + PropertyInfo info = GetInfo(plugin); + + // Call + IObjectProperties objectProperties = info.CreateInstance(context); + + // Assert + Assert.IsInstanceOf(objectProperties); + Assert.AreSame(context, objectProperties.Data); + + double expectedAssessmentLevel = normType == NormType.Signaling + ? designWaterLevelSignaling + : designWaterLevelLowerLimit; + Assert.AreEqual(expectedAssessmentLevel, ((StabilityStoneCoverWaveConditionsInputContextProperties) objectProperties).AssessmentLevel); + } + } + + private static PropertyInfo GetInfo(StabilityStoneCoverPlugin plugin) + { + return plugin.GetPropertyInfos().First(pi => pi.DataType == typeof(StabilityStoneCoverWaveConditionsInputContext)); + } + } +} \ No newline at end of file Index: Ringtoets/StabilityStoneCover/test/Ringtoets.StabilityStoneCover.Plugin.Test/Ringtoets.StabilityStoneCover.Plugin.Test.csproj =================================================================== diff -u -rac96d7c315129af851634ed5a4a6800b59ede718 -r026939d282e7281edebc62e49794d9648e574382 --- Ringtoets/StabilityStoneCover/test/Ringtoets.StabilityStoneCover.Plugin.Test/Ringtoets.StabilityStoneCover.Plugin.Test.csproj (.../Ringtoets.StabilityStoneCover.Plugin.Test.csproj) (revision ac96d7c315129af851634ed5a4a6800b59ede718) +++ Ringtoets/StabilityStoneCover/test/Ringtoets.StabilityStoneCover.Plugin.Test/Ringtoets.StabilityStoneCover.Plugin.Test.csproj (.../Ringtoets.StabilityStoneCover.Plugin.Test.csproj) (revision 026939d282e7281edebc62e49794d9648e574382) @@ -31,6 +31,7 @@ + Index: Ringtoets/WaveImpactAsphaltCover/test/Ringtoets.WaveImpactAsphaltCover.Plugin.Test/PropertyInfos/WaveImpactAsphaltCoverWaveConditionsInputContextPropertyInfoTest.cs =================================================================== diff -u --- Ringtoets/WaveImpactAsphaltCover/test/Ringtoets.WaveImpactAsphaltCover.Plugin.Test/PropertyInfos/WaveImpactAsphaltCoverWaveConditionsInputContextPropertyInfoTest.cs (revision 0) +++ Ringtoets/WaveImpactAsphaltCover/test/Ringtoets.WaveImpactAsphaltCover.Plugin.Test/PropertyInfos/WaveImpactAsphaltCoverWaveConditionsInputContextPropertyInfoTest.cs (revision 026939d282e7281edebc62e49794d9648e574382) @@ -0,0 +1,115 @@ +// 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.Linq; +using Core.Common.Gui.Plugin; +using Core.Common.Gui.PropertyBag; +using NUnit.Framework; +using Ringtoets.Common.Data.Contribution; +using Ringtoets.Common.Data.DikeProfiles; +using Ringtoets.Common.Data.TestUtil; +using Ringtoets.WaveImpactAsphaltCover.Data; +using Ringtoets.WaveImpactAsphaltCover.Forms.PresentationObjects; +using Ringtoets.WaveImpactAsphaltCover.Forms.PropertyClasses; + +namespace Ringtoets.WaveImpactAsphaltCover.Plugin.Test.PropertyInfos +{ + [TestFixture] + public class WaveImpactAsphaltCoverWaveConditionsInputContextPropertyInfoTest + { + [Test] + public void Initialized_Always_ExpectedPropertiesSet() + { + // Setup + using (var plugin = new WaveImpactAsphaltCoverPlugin()) + { + // Call + PropertyInfo info = GetInfo(plugin); + + // Assert + Assert.AreEqual(typeof(WaveImpactAsphaltCoverWaveConditionsInputContext), info.DataType); + Assert.AreEqual(typeof(WaveImpactAsphaltCoverWaveConditionsInputContextProperties), info.PropertyObjectType); + } + } + + [TestCase(NormType.Signaling)] + [TestCase(NormType.LowerLimit)] + public void CreateInstance_Always_ExpectedProperties(NormType normType) + { + // Setup + const double designWaterLevelSignaling = 1.1; + const double designWaterLevelLowerLimit = 2.2; + + var testHydraulicBoundaryLocation = new TestHydraulicBoundaryLocation + { + DesignWaterLevelCalculation2 = + { + Output = new TestHydraulicBoundaryLocationOutput(designWaterLevelSignaling) + }, + DesignWaterLevelCalculation3 = + { + Output = new TestHydraulicBoundaryLocationOutput(designWaterLevelLowerLimit) + } + }; + var calculation = new WaveImpactAsphaltCoverWaveConditionsCalculation + { + InputParameters = + { + HydraulicBoundaryLocation = testHydraulicBoundaryLocation + } + }; + var assessmentSection = new ObservableTestAssessmentSectionStub + { + FailureMechanismContribution = + { + NormativeNorm = normType + } + }; + + var context = new WaveImpactAsphaltCoverWaveConditionsInputContext(calculation.InputParameters, + calculation, + assessmentSection, + new ForeshoreProfile[0]); + + using (var plugin = new WaveImpactAsphaltCoverPlugin()) + { + PropertyInfo info = GetInfo(plugin); + + // Call + IObjectProperties objectProperties = info.CreateInstance(context); + + // Assert + Assert.IsInstanceOf(objectProperties); + Assert.AreSame(context, objectProperties.Data); + + double expectedAssessmentLevel = normType == NormType.Signaling + ? designWaterLevelSignaling + : designWaterLevelLowerLimit; + Assert.AreEqual(expectedAssessmentLevel, ((WaveImpactAsphaltCoverWaveConditionsInputContextProperties) objectProperties).AssessmentLevel); + } + } + + private static PropertyInfo GetInfo(WaveImpactAsphaltCoverPlugin plugin) + { + return plugin.GetPropertyInfos().First(pi => pi.DataType == typeof(WaveImpactAsphaltCoverWaveConditionsInputContext)); + } + } +} \ No newline at end of file Index: Ringtoets/WaveImpactAsphaltCover/test/Ringtoets.WaveImpactAsphaltCover.Plugin.Test/Ringtoets.WaveImpactAsphaltCover.Plugin.Test.csproj =================================================================== diff -u -rac96d7c315129af851634ed5a4a6800b59ede718 -r026939d282e7281edebc62e49794d9648e574382 --- Ringtoets/WaveImpactAsphaltCover/test/Ringtoets.WaveImpactAsphaltCover.Plugin.Test/Ringtoets.WaveImpactAsphaltCover.Plugin.Test.csproj (.../Ringtoets.WaveImpactAsphaltCover.Plugin.Test.csproj) (revision ac96d7c315129af851634ed5a4a6800b59ede718) +++ Ringtoets/WaveImpactAsphaltCover/test/Ringtoets.WaveImpactAsphaltCover.Plugin.Test/Ringtoets.WaveImpactAsphaltCover.Plugin.Test.csproj (.../Ringtoets.WaveImpactAsphaltCover.Plugin.Test.csproj) (revision 026939d282e7281edebc62e49794d9648e574382) @@ -30,6 +30,7 @@ +