Index: Riskeer/ClosingStructures/test/Riskeer.ClosingStructures.IO.Test/Configurations/ClosingStructuresCalculationConfigurationTest.cs =================================================================== diff -u -rd28e27005c5da2025e65e0544e70f89e5c08b67e -rc8fa380f299fb7cca0d07d835ddf9b3bc7c9719e --- Riskeer/ClosingStructures/test/Riskeer.ClosingStructures.IO.Test/Configurations/ClosingStructuresCalculationConfigurationTest.cs (.../ClosingStructuresCalculationConfigurationTest.cs) (revision d28e27005c5da2025e65e0544e70f89e5c08b67e) +++ Riskeer/ClosingStructures/test/Riskeer.ClosingStructures.IO.Test/Configurations/ClosingStructuresCalculationConfigurationTest.cs (.../ClosingStructuresCalculationConfigurationTest.cs) (revision c8fa380f299fb7cca0d07d835ddf9b3bc7c9719e) @@ -19,8 +19,6 @@ // Stichting Deltares and remain full property of Stichting Deltares at all times. // All rights reserved. -using System; -using Core.Common.TestUtil; using NUnit.Framework; using Riskeer.ClosingStructures.IO.Configurations; using Riskeer.Common.IO.Configurations; @@ -31,17 +29,6 @@ public class ClosingStructuresCalculationConfigurationTest { [Test] - public void Constructor_NameNull_ThrowsArgumentNullException() - { - // Call - TestDelegate call = () => new ClosingStructuresCalculationConfiguration(null); - - // Assert - string paramName = Assert.Throws(call).ParamName; - Assert.AreEqual("value", paramName); - } - - [Test] public void Constructor_WithName_ExpectedValues() { // Call @@ -63,67 +50,5 @@ Assert.IsNull(configuration.FailureProbabilityReparation); Assert.IsNull(configuration.ProbabilityOpenStructureBeforeFlooding); } - - [Test] - public void SimpleProperties_SetNewValues_NewValuesSet() - { - // Setup - var random = new Random(21); - var inflowModelType = random.NextEnumValue(); - var insideWaterLevel = new StochastConfiguration(); - var modelFactorSuperCriticalFlow = new StochastConfiguration(); - var drainCoefficient = new StochastConfiguration(); - var thresholdHeightOpenWeir = new StochastConfiguration(); - var areaFlowApertures = new StochastConfiguration(); - var levelCrestStructureNotClosing = new StochastConfiguration(); - int identicalApertures = random.Next(1, 5); - double factorStormDurationOpenStructure = random.NextDouble(); - double failureProbabilityOpenStructure = random.NextDouble(); - double failureProbabilityReparation = random.NextDouble(); - double probabilityOpenStructureBeforeFlooding = random.NextDouble(); - - var configuration = new ClosingStructuresCalculationConfiguration("some name"); - - // Call - configuration.InflowModelType = inflowModelType; - configuration.InsideWaterLevel = insideWaterLevel; - configuration.ModelFactorSuperCriticalFlow = modelFactorSuperCriticalFlow; - configuration.DrainCoefficient = drainCoefficient; - configuration.ThresholdHeightOpenWeir = thresholdHeightOpenWeir; - configuration.AreaFlowApertures = areaFlowApertures; - configuration.LevelCrestStructureNotClosing = levelCrestStructureNotClosing; - configuration.IdenticalApertures = identicalApertures; - configuration.FactorStormDurationOpenStructure = factorStormDurationOpenStructure; - configuration.FailureProbabilityOpenStructure = failureProbabilityOpenStructure; - configuration.FailureProbabilityReparation = failureProbabilityReparation; - configuration.ProbabilityOpenStructureBeforeFlooding = probabilityOpenStructureBeforeFlooding; - - // Assert - Assert.AreEqual(inflowModelType, configuration.InflowModelType); - Assert.AreSame(insideWaterLevel, configuration.InsideWaterLevel); - Assert.AreSame(modelFactorSuperCriticalFlow, configuration.ModelFactorSuperCriticalFlow); - Assert.AreSame(drainCoefficient, configuration.DrainCoefficient); - Assert.AreSame(thresholdHeightOpenWeir, configuration.ThresholdHeightOpenWeir); - Assert.AreSame(areaFlowApertures, configuration.AreaFlowApertures); - Assert.AreSame(levelCrestStructureNotClosing, configuration.LevelCrestStructureNotClosing); - Assert.AreEqual(identicalApertures, configuration.IdenticalApertures); - Assert.AreEqual(factorStormDurationOpenStructure, configuration.FactorStormDurationOpenStructure); - Assert.AreEqual(failureProbabilityOpenStructure, configuration.FailureProbabilityOpenStructure); - Assert.AreEqual(failureProbabilityReparation, configuration.FailureProbabilityReparation); - Assert.AreEqual(probabilityOpenStructureBeforeFlooding, configuration.ProbabilityOpenStructureBeforeFlooding); - } - - [Test] - public void Name_Null_ThrowsArgumentNullException() - { - // Setup - var calculationConfiguration = new ClosingStructuresCalculationConfiguration("valid name"); - - // Call - TestDelegate test = () => calculationConfiguration.Name = null; - - // Assert - Assert.Throws(test); - } } } \ No newline at end of file Fisheye: Tag c8fa380f299fb7cca0d07d835ddf9b3bc7c9719e refers to a dead (removed) revision in file `Riskeer/Common/test/Riskeer.Common.IO.Test/Configurations/StructureCalculationConfigurationTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Riskeer/Common/test/Riskeer.Common.IO.Test/Configurations/StructuresCalculationConfigurationTest.cs =================================================================== diff -u --- Riskeer/Common/test/Riskeer.Common.IO.Test/Configurations/StructuresCalculationConfigurationTest.cs (revision 0) +++ Riskeer/Common/test/Riskeer.Common.IO.Test/Configurations/StructuresCalculationConfigurationTest.cs (revision c8fa380f299fb7cca0d07d835ddf9b3bc7c9719e) @@ -0,0 +1,90 @@ +// Copyright (C) Stichting Deltares 2019. All rights reserved. +// +// This file is part of Riskeer. +// +// Riskeer 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 NUnit.Framework; +using Riskeer.Common.IO.Configurations; + +namespace Riskeer.Common.IO.Test.Configurations +{ + [TestFixture] + public class StructuresCalculationConfigurationTest + { + [Test] + public void Constructor_WithoutName_ThrowsArgumentNullException() + { + // Call + void Call() => new TestStructuresCalculationConfiguration(null); + + // Assert + var exception = Assert.Throws(Call); + Assert.AreEqual("value", exception.ParamName); + Assert.AreEqual("Name is required for a calculation configuration.\r\nParameter name: value", exception.Message); + } + + [Test] + public void Constructor_WithName_ExpectedValues() + { + // Setup + const string name = "name"; + + // Call + var configuration = new TestStructuresCalculationConfiguration(name); + + // Assert + Assert.IsInstanceOf(configuration); + Assert.AreEqual(name, configuration.Name); + Assert.IsNull(configuration.StructureId); + Assert.IsNull(configuration.HydraulicBoundaryLocationName); + Assert.IsNull(configuration.StormDuration); + Assert.IsNull(configuration.StructureNormalOrientation); + Assert.IsNull(configuration.AllowedLevelIncreaseStorage); + Assert.IsNull(configuration.StorageStructureArea); + Assert.IsNull(configuration.FlowWidthAtBottomProtection); + Assert.IsNull(configuration.CriticalOvertoppingDischarge); + Assert.IsNull(configuration.FailureProbabilityStructureWithErosion); + Assert.IsNull(configuration.WidthFlowApertures); + Assert.IsNull(configuration.ForeshoreProfileId); + Assert.IsNull(configuration.WaveReduction); + Assert.IsNull(configuration.ShouldIllustrationPointsBeCalculated); + } + + [Test] + public void Name_Null_ThrowsArgumentNullException() + { + // Setup + var calculationConfiguration = new TestStructuresCalculationConfiguration("valid name"); + + // Call + void Call() => calculationConfiguration.Name = null; + + // Assert + var exception = Assert.Throws(Call); + Assert.AreEqual("value", exception.ParamName); + Assert.AreEqual("Name is required for a calculation configuration.\r\nParameter name: value", exception.Message); + } + + private class TestStructuresCalculationConfiguration : StructuresCalculationConfiguration + { + public TestStructuresCalculationConfiguration(string name) : base(name) {} + } + } +} \ No newline at end of file Index: Riskeer/HeightStructures/test/Riskeer.HeightStructures.IO.Test/Configurations/HeightStructuresCalculationConfigurationTest.cs =================================================================== diff -u -r86594ccd7329d320872573a1d066fe18959d3cea -rc8fa380f299fb7cca0d07d835ddf9b3bc7c9719e --- Riskeer/HeightStructures/test/Riskeer.HeightStructures.IO.Test/Configurations/HeightStructuresCalculationConfigurationTest.cs (.../HeightStructuresCalculationConfigurationTest.cs) (revision 86594ccd7329d320872573a1d066fe18959d3cea) +++ Riskeer/HeightStructures/test/Riskeer.HeightStructures.IO.Test/Configurations/HeightStructuresCalculationConfigurationTest.cs (.../HeightStructuresCalculationConfigurationTest.cs) (revision c8fa380f299fb7cca0d07d835ddf9b3bc7c9719e) @@ -19,7 +19,6 @@ // Stichting Deltares and remain full property of Stichting Deltares at all times. // All rights reserved. -using System; using NUnit.Framework; using Riskeer.Common.IO.Configurations; using Riskeer.HeightStructures.IO.Configurations; @@ -30,17 +29,6 @@ public class HeightStructuresCalculationConfigurationTest { [Test] - public void Constructor_NameNull_ThrowsArgumentNullException() - { - // Call - TestDelegate call = () => new HeightStructuresCalculationConfiguration(null); - - // Assert - string paramName = Assert.Throws(call).ParamName; - Assert.AreEqual("value", paramName); - } - - [Test] public void Constructor_WithName_ExpectedValues() { // Call @@ -52,35 +40,5 @@ Assert.IsNull(configuration.ModelFactorSuperCriticalFlow); Assert.IsNull(configuration.LevelCrestStructure); } - - [Test] - public void SimpleProperties_SetNewValues_NewValuesSet() - { - // Setup - var modelFactorSuperCriticalFlow = new StochastConfiguration(); - var levelCrestStructure = new StochastConfiguration(); - var configuration = new HeightStructuresCalculationConfiguration("some name"); - - // Call - configuration.ModelFactorSuperCriticalFlow = modelFactorSuperCriticalFlow; - configuration.LevelCrestStructure = levelCrestStructure; - - // Assert - Assert.AreSame(modelFactorSuperCriticalFlow, configuration.ModelFactorSuperCriticalFlow); - Assert.AreSame(levelCrestStructure, configuration.LevelCrestStructure); - } - - [Test] - public void Name_Null_ThrowsArgumentNullException() - { - // Setup - var calculationConfiguration = new HeightStructuresCalculationConfiguration("valid name"); - - // Call - TestDelegate test = () => calculationConfiguration.Name = null; - - // Assert - Assert.Throws(test); - } } } \ No newline at end of file Index: Riskeer/StabilityPointStructures/test/Riskeer.StabilityPointStructures.IO.Test/Configurations/StabilityPointStructuresCalculationConfigurationTest.cs =================================================================== diff -u -r86594ccd7329d320872573a1d066fe18959d3cea -rc8fa380f299fb7cca0d07d835ddf9b3bc7c9719e --- Riskeer/StabilityPointStructures/test/Riskeer.StabilityPointStructures.IO.Test/Configurations/StabilityPointStructuresCalculationConfigurationTest.cs (.../StabilityPointStructuresCalculationConfigurationTest.cs) (revision 86594ccd7329d320872573a1d066fe18959d3cea) +++ Riskeer/StabilityPointStructures/test/Riskeer.StabilityPointStructures.IO.Test/Configurations/StabilityPointStructuresCalculationConfigurationTest.cs (.../StabilityPointStructuresCalculationConfigurationTest.cs) (revision c8fa380f299fb7cca0d07d835ddf9b3bc7c9719e) @@ -19,8 +19,6 @@ // Stichting Deltares and remain full property of Stichting Deltares at all times. // All rights reserved. -using System; -using Core.Common.TestUtil; using NUnit.Framework; using Riskeer.Common.IO.Configurations; using Riskeer.StabilityPointStructures.IO.Configurations; @@ -31,17 +29,6 @@ public class StabilityPointStructuresCalculationConfigurationTest { [Test] - public void Constructor_NameNull_ThrowsArgumentNullException() - { - // Call - TestDelegate call = () => new StabilityPointStructuresCalculationConfiguration(null); - - // Assert - string paramName = Assert.Throws(call).ParamName; - Assert.AreEqual("value", paramName); - } - - [Test] public void Constructor_WithName_ExpectedValues() { // Setup @@ -78,106 +65,5 @@ Assert.IsNull(configuration.VerticalDistance); Assert.IsNull(configuration.VolumicWeightWater); } - - [Test] - public void Properties_SetNewValues_NewValuesSet() - { - // Setup - var configuration = new StabilityPointStructuresCalculationConfiguration("some name"); - var random = new Random(5432); - - var areaFlowApertures = new StochastConfiguration(); - var bankWidth = new StochastConfiguration(); - var drainCoefficient = new StochastConfiguration(); - var insideWaterLevel = new StochastConfiguration(); - var insideWaterLevelFailureConstruction = new StochastConfiguration(); - var levelCrestStructure = new StochastConfiguration(); - var thresholdHeightOpenWeir = new StochastConfiguration(); - - var constructiveStrengthLinearLoadModel = new StochastConfiguration(); - var constructiveStrengthQuadraticLoadModel = new StochastConfiguration(); - var failureCollisionEnergy = new StochastConfiguration(); - var flowVelocityStructureClosable = new StochastConfiguration(); - var shipMass = new StochastConfiguration(); - var shipVelocity = new StochastConfiguration(); - var stabilityLinearLoadModel = new StochastConfiguration(); - var stabilityQuadraticLoadModel = new StochastConfiguration(); - - int levellingCount = random.Next(); - double evaluationLevel = random.NextDouble(); - double factorStormDurationOpenStructure = random.NextDouble(); - double failureProbabilityRepairClosure = random.NextDouble(); - double probabilityCollisionSecondaryStructure = random.NextDouble(); - double verticalDistance = random.NextDouble(); - double volumicWeightWater = random.NextDouble(); - - var inflowModelType = random.NextEnumValue(); - var loadSchematizationType = random.NextEnumValue(); - - // Call - configuration.AreaFlowApertures = areaFlowApertures; - configuration.BankWidth = bankWidth; - configuration.ConstructiveStrengthLinearLoadModel = constructiveStrengthLinearLoadModel; - configuration.ConstructiveStrengthQuadraticLoadModel = constructiveStrengthQuadraticLoadModel; - configuration.DrainCoefficient = drainCoefficient; - configuration.EvaluationLevel = evaluationLevel; - configuration.FactorStormDurationOpenStructure = factorStormDurationOpenStructure; - configuration.FailureCollisionEnergy = failureCollisionEnergy; - configuration.FailureProbabilityRepairClosure = failureProbabilityRepairClosure; - configuration.FlowVelocityStructureClosable = flowVelocityStructureClosable; - configuration.InflowModelType = inflowModelType; - configuration.InsideWaterLevel = insideWaterLevel; - configuration.InsideWaterLevelFailureConstruction = insideWaterLevelFailureConstruction; - configuration.LevelCrestStructure = levelCrestStructure; - configuration.LevellingCount = levellingCount; - configuration.LoadSchematizationType = loadSchematizationType; - configuration.ProbabilityCollisionSecondaryStructure = probabilityCollisionSecondaryStructure; - configuration.ShipMass = shipMass; - configuration.ShipVelocity = shipVelocity; - configuration.StabilityLinearLoadModel = stabilityLinearLoadModel; - configuration.StabilityQuadraticLoadModel = stabilityQuadraticLoadModel; - configuration.ThresholdHeightOpenWeir = thresholdHeightOpenWeir; - configuration.VerticalDistance = verticalDistance; - configuration.VolumicWeightWater = volumicWeightWater; - - // Assert - Assert.AreSame(areaFlowApertures, configuration.AreaFlowApertures); - Assert.AreSame(bankWidth, configuration.BankWidth); - Assert.AreSame(constructiveStrengthLinearLoadModel, configuration.ConstructiveStrengthLinearLoadModel); - Assert.AreSame(constructiveStrengthQuadraticLoadModel, configuration.ConstructiveStrengthQuadraticLoadModel); - Assert.AreSame(drainCoefficient, configuration.DrainCoefficient); - Assert.AreEqual(evaluationLevel, configuration.EvaluationLevel); - Assert.AreEqual(factorStormDurationOpenStructure, configuration.FactorStormDurationOpenStructure); - Assert.AreSame(failureCollisionEnergy, configuration.FailureCollisionEnergy); - Assert.AreEqual(failureProbabilityRepairClosure, configuration.FailureProbabilityRepairClosure); - Assert.AreSame(flowVelocityStructureClosable, configuration.FlowVelocityStructureClosable); - Assert.AreEqual(inflowModelType, configuration.InflowModelType); - Assert.AreEqual(insideWaterLevel, configuration.InsideWaterLevel); - Assert.AreEqual(insideWaterLevelFailureConstruction, configuration.InsideWaterLevelFailureConstruction); - Assert.AreEqual(levelCrestStructure, configuration.LevelCrestStructure); - Assert.AreEqual(levellingCount, configuration.LevellingCount); - Assert.AreEqual(loadSchematizationType, configuration.LoadSchematizationType); - Assert.AreEqual(probabilityCollisionSecondaryStructure, configuration.ProbabilityCollisionSecondaryStructure); - Assert.AreSame(shipMass, configuration.ShipMass); - Assert.AreSame(shipVelocity, configuration.ShipVelocity); - Assert.AreSame(stabilityLinearLoadModel, configuration.StabilityLinearLoadModel); - Assert.AreSame(stabilityQuadraticLoadModel, configuration.StabilityQuadraticLoadModel); - Assert.AreSame(thresholdHeightOpenWeir, configuration.ThresholdHeightOpenWeir); - Assert.AreEqual(verticalDistance, configuration.VerticalDistance); - Assert.AreEqual(volumicWeightWater, configuration.VolumicWeightWater); - } - - [Test] - public void Name_Null_ThrowsArgumentNullException() - { - // Setup - var calculationConfiguration = new StabilityPointStructuresCalculationConfiguration("valid name"); - - // Call - TestDelegate test = () => calculationConfiguration.Name = null; - - // Assert - Assert.Throws(test); - } } } \ No newline at end of file