Index: Riskeer/ClosingStructures/src/Riskeer.ClosingStructures.IO/Configurations/ClosingStructuresCalculationConfigurationImporter.cs =================================================================== diff -u -rf5cd3b2ee9b7436f606ee6bc027b795accf0549d -r8611667bb3db61470828f71f5bb80a0fd892278e --- Riskeer/ClosingStructures/src/Riskeer.ClosingStructures.IO/Configurations/ClosingStructuresCalculationConfigurationImporter.cs (.../ClosingStructuresCalculationConfigurationImporter.cs) (revision f5cd3b2ee9b7436f606ee6bc027b795accf0549d) +++ Riskeer/ClosingStructures/src/Riskeer.ClosingStructures.IO/Configurations/ClosingStructuresCalculationConfigurationImporter.cs (.../ClosingStructuresCalculationConfigurationImporter.cs) (revision 8611667bb3db61470828f71f5bb80a0fd892278e) @@ -110,7 +110,7 @@ protected override ICalculation ParseReadCalculation(ClosingStructuresCalculationConfiguration readCalculation) { - var calculation = new StructuresCalculation + var calculation = new StructuresCalculationScenario { Name = readCalculation.Name }; @@ -436,9 +436,7 @@ private bool TrySetHydraulicBoundaryLocation(string locationName, StructuresCalculation calculation) { - HydraulicBoundaryLocation location; - - if (TryReadHydraulicBoundaryLocation(locationName, calculation.Name, availableHydraulicBoundaryLocations, out location)) + if (TryReadHydraulicBoundaryLocation(locationName, calculation.Name, availableHydraulicBoundaryLocations, out HydraulicBoundaryLocation location)) { calculation.InputParameters.HydraulicBoundaryLocation = location; return true; @@ -449,9 +447,7 @@ private bool TrySetStructure(string structureId, StructuresCalculation calculation) { - ClosingStructure structure; - - if (TryReadStructure(structureId, calculation.Name, availableStructures, out structure)) + if (TryReadStructure(structureId, calculation.Name, availableStructures, out ClosingStructure structure)) { calculation.InputParameters.Structure = structure; return true; @@ -462,9 +458,7 @@ private bool TrySetForeshoreProfile(string foreshoreProfileName, StructuresCalculation calculation) { - ForeshoreProfile foreshoreProfile; - - if (TryReadForeshoreProfile(foreshoreProfileName, calculation.Name, availableForeshoreProfiles, out foreshoreProfile)) + if (TryReadForeshoreProfile(foreshoreProfileName, calculation.Name, availableForeshoreProfiles, out ForeshoreProfile foreshoreProfile)) { calculation.InputParameters.ForeshoreProfile = foreshoreProfile; return true; Index: Riskeer/ClosingStructures/test/Riskeer.ClosingStructures.IO.Test/Configurations/ClosingStructuresCalculationConfigurationImporterTest.cs =================================================================== diff -u -r4a91111c1fda2c629fef0f552a2b33d9dbb5df92 -r8611667bb3db61470828f71f5bb80a0fd892278e --- Riskeer/ClosingStructures/test/Riskeer.ClosingStructures.IO.Test/Configurations/ClosingStructuresCalculationConfigurationImporterTest.cs (.../ClosingStructuresCalculationConfigurationImporterTest.cs) (revision 4a91111c1fda2c629fef0f552a2b33d9dbb5df92) +++ Riskeer/ClosingStructures/test/Riskeer.ClosingStructures.IO.Test/Configurations/ClosingStructuresCalculationConfigurationImporterTest.cs (.../ClosingStructuresCalculationConfigurationImporterTest.cs) (revision 8611667bb3db61470828f71f5bb80a0fd892278e) @@ -226,63 +226,47 @@ public void Constructor_HydraulicBoundaryLocationsNull_ThrowArgumentNullException() { // Call - TestDelegate test = () => new ClosingStructuresCalculationConfigurationImporter("", - new CalculationGroup(), - null, - Enumerable.Empty(), - Enumerable.Empty(), - new ClosingStructuresFailureMechanism()); + void Call() => new ClosingStructuresCalculationConfigurationImporter("", new CalculationGroup(), null, Enumerable.Empty(), + Enumerable.Empty(), new ClosingStructuresFailureMechanism()); // Assert - var exception = Assert.Throws(test); + var exception = Assert.Throws(Call); Assert.AreEqual("hydraulicBoundaryLocations", exception.ParamName); } [Test] public void Constructor_ForeshoreProfilesNull_ThrowArgumentNullException() { // Call - TestDelegate test = () => new ClosingStructuresCalculationConfigurationImporter("", - new CalculationGroup(), - Enumerable.Empty(), - null, - Enumerable.Empty(), - new ClosingStructuresFailureMechanism()); + void Call() => new ClosingStructuresCalculationConfigurationImporter("", new CalculationGroup(), Enumerable.Empty(), + null, Enumerable.Empty(), new ClosingStructuresFailureMechanism()); // Assert - var exception = Assert.Throws(test); + var exception = Assert.Throws(Call); Assert.AreEqual("foreshoreProfiles", exception.ParamName); } [Test] public void Constructor_StructuresNull_ThrowArgumentNullException() { // Call - TestDelegate test = () => new ClosingStructuresCalculationConfigurationImporter("", - new CalculationGroup(), - Enumerable.Empty(), - Enumerable.Empty(), - null, - new ClosingStructuresFailureMechanism()); + void Call() => new ClosingStructuresCalculationConfigurationImporter("", new CalculationGroup(), Enumerable.Empty(), + Enumerable.Empty(), null, new ClosingStructuresFailureMechanism()); // Assert - var exception = Assert.Throws(test); + var exception = Assert.Throws(Call); Assert.AreEqual("structures", exception.ParamName); } [Test] public void Constructor_FailureMechanismNull_ThrowArgumentNullException() { // Call - TestDelegate test = () => new ClosingStructuresCalculationConfigurationImporter("", - new CalculationGroup(), - Enumerable.Empty(), - Enumerable.Empty(), - Enumerable.Empty(), - null); + void Call() => new ClosingStructuresCalculationConfigurationImporter("", new CalculationGroup(), Enumerable.Empty(), + Enumerable.Empty(), Enumerable.Empty(), null); // Assert - var exception = Assert.Throws(test); + var exception = Assert.Throws(Call); Assert.AreEqual("failureMechanism", exception.ParamName); } @@ -313,11 +297,11 @@ var successful = false; // Call - Action call = () => successful = importer.Import(); + void Call() => successful = importer.Import(); // Assert string expectedMessage = $"{expectedErrorMessage} Berekening 'Berekening 1' is overgeslagen."; - TestHelper.AssertLogMessageWithLevelIsGenerated(call, Tuple.Create(expectedMessage, LogLevelConstant.Error), 2); + TestHelper.AssertLogMessageWithLevelIsGenerated(Call, Tuple.Create(expectedMessage, LogLevelConstant.Error), 2); Assert.IsTrue(successful); CollectionAssert.IsEmpty(calculationGroup.Children); } @@ -344,11 +328,11 @@ var successful = false; // Call - Action call = () => successful = importer.Import(); + void Call() => successful = importer.Import(); // Assert const string expectedMessage = "Het opgegeven voorlandprofiel 'Voorlandprofiel' heeft geen voorlandgeometrie en kan daarom niet gebruikt worden. Berekening 'Berekening 1' is overgeslagen."; - TestHelper.AssertLogMessageWithLevelIsGenerated(call, Tuple.Create(expectedMessage, LogLevelConstant.Error), 2); + TestHelper.AssertLogMessageWithLevelIsGenerated(Call, Tuple.Create(expectedMessage, LogLevelConstant.Error), 2); Assert.IsTrue(successful); CollectionAssert.IsEmpty(calculationGroup.Children); } @@ -385,13 +369,13 @@ // Call var successful = false; - Action call = () => successful = importer.Import(); + void Call() => successful = importer.Import(); // Assert - TestHelper.AssertLogMessageIsGenerated(call, $"Gegevens zijn geïmporteerd vanuit bestand '{filePath}'.", 1); + TestHelper.AssertLogMessageIsGenerated(Call, $"Gegevens zijn geïmporteerd vanuit bestand '{filePath}'.", 1); Assert.IsTrue(successful); - var expectedCalculation = new StructuresCalculation + var expectedCalculation = new StructuresCalculationScenario { Name = "Berekening 1", InputParameters = @@ -476,7 +460,7 @@ }; Assert.AreEqual(1, calculationGroup.Children.Count); - AssertCalculation(expectedCalculation, (StructuresCalculation) calculationGroup.Children[0]); + AssertCalculation(expectedCalculation, (StructuresCalculationScenario) calculationGroup.Children[0]); } [Test] @@ -498,7 +482,7 @@ }, new ClosingStructuresFailureMechanism()); - var expectedCalculation = new StructuresCalculation + var expectedCalculation = new StructuresCalculationScenario { Name = "Berekening 1", InputParameters = @@ -561,7 +545,7 @@ // Assert Assert.IsTrue(successful); Assert.AreEqual(1, calculationGroup.Children.Count); - AssertCalculation(expectedCalculation, (StructuresCalculation) calculationGroup.Children[0]); + AssertCalculation(expectedCalculation, (StructuresCalculationScenario) calculationGroup.Children[0]); } [Test] @@ -583,7 +567,7 @@ }, new ClosingStructuresFailureMechanism()); - var expectedCalculation = new StructuresCalculation + var expectedCalculation = new StructuresCalculationScenario { Name = "Berekening 1", InputParameters = @@ -634,7 +618,7 @@ // Assert Assert.IsTrue(successful); Assert.AreEqual(1, calculationGroup.Children.Count); - AssertCalculation(expectedCalculation, (StructuresCalculation) calculationGroup.Children[0]); + AssertCalculation(expectedCalculation, (StructuresCalculationScenario) calculationGroup.Children[0]); } [Test] @@ -660,7 +644,7 @@ }, new ClosingStructuresFailureMechanism()); - var expectedCalculation = new StructuresCalculation + var expectedCalculation = new StructuresCalculationScenario { Name = "Berekening 1" }; @@ -671,7 +655,7 @@ // Assert Assert.IsTrue(successful); Assert.AreEqual(1, calculationGroup.Children.Count); - AssertCalculation(expectedCalculation, (StructuresCalculation) calculationGroup.Children[0]); + AssertCalculation(expectedCalculation, (StructuresCalculationScenario) calculationGroup.Children[0]); } [Test] @@ -752,9 +736,12 @@ CollectionAssert.IsEmpty(calculationGroup.Children); } - private static void AssertCalculation(StructuresCalculation expectedCalculation, StructuresCalculation actualCalculation) + private static void AssertCalculation(StructuresCalculationScenario expectedCalculation, StructuresCalculationScenario actualCalculation) { Assert.AreEqual(expectedCalculation.Name, actualCalculation.Name); + Assert.AreEqual(expectedCalculation.IsRelevant, actualCalculation.IsRelevant); + Assert.AreEqual(expectedCalculation.Contribution, actualCalculation.Contribution); + Assert.AreSame(expectedCalculation.InputParameters.HydraulicBoundaryLocation, actualCalculation.InputParameters.HydraulicBoundaryLocation); Assert.AreEqual(expectedCalculation.InputParameters.StructureNormalOrientation, actualCalculation.InputParameters.StructureNormalOrientation); Assert.AreEqual(expectedCalculation.InputParameters.FactorStormDurationOpenStructure, actualCalculation.InputParameters.FactorStormDurationOpenStructure); Index: Riskeer/GrassCoverErosionInwards/test/Riskeer.GrassCoverErosionInwards.IO.Test/Configurations/GrassCoverErosionInwardsCalculationConfigurationImporterTest.cs =================================================================== diff -u -r3c34c113e32474c35b24544c710136585b89ac04 -r8611667bb3db61470828f71f5bb80a0fd892278e --- Riskeer/GrassCoverErosionInwards/test/Riskeer.GrassCoverErosionInwards.IO.Test/Configurations/GrassCoverErosionInwardsCalculationConfigurationImporterTest.cs (.../GrassCoverErosionInwardsCalculationConfigurationImporterTest.cs) (revision 3c34c113e32474c35b24544c710136585b89ac04) +++ Riskeer/GrassCoverErosionInwards/test/Riskeer.GrassCoverErosionInwards.IO.Test/Configurations/GrassCoverErosionInwardsCalculationConfigurationImporterTest.cs (.../GrassCoverErosionInwardsCalculationConfigurationImporterTest.cs) (revision 8611667bb3db61470828f71f5bb80a0fd892278e) @@ -535,9 +535,12 @@ AssertCalculation(expectedCalculation, (GrassCoverErosionInwardsCalculationScenario) calculationGroup.Children[0]); } - private static void AssertCalculation(GrassCoverErosionInwardsCalculation expectedCalculation, GrassCoverErosionInwardsCalculation actualCalculation) + private static void AssertCalculation(GrassCoverErosionInwardsCalculationScenario expectedCalculation, GrassCoverErosionInwardsCalculationScenario actualCalculation) { Assert.AreEqual(expectedCalculation.Name, actualCalculation.Name); + Assert.AreEqual(expectedCalculation.IsRelevant, actualCalculation.IsRelevant); + Assert.AreEqual(expectedCalculation.Contribution, actualCalculation.Contribution); + Assert.AreSame(expectedCalculation.InputParameters.HydraulicBoundaryLocation, actualCalculation.InputParameters.HydraulicBoundaryLocation); Assert.AreEqual(expectedCalculation.InputParameters.Orientation, actualCalculation.InputParameters.Orientation); Assert.AreEqual(expectedCalculation.InputParameters.DikeProfile, actualCalculation.InputParameters.DikeProfile); Index: Riskeer/Integration/src/Riskeer.Integration.Plugin/Merge/AssessmentSectionMergeHandler.cs =================================================================== diff -u -r079e42bc128e70aa23afb417b1dea7a0b522579f -r8611667bb3db61470828f71f5bb80a0fd892278e --- Riskeer/Integration/src/Riskeer.Integration.Plugin/Merge/AssessmentSectionMergeHandler.cs (.../AssessmentSectionMergeHandler.cs) (revision 079e42bc128e70aa23afb417b1dea7a0b522579f) +++ Riskeer/Integration/src/Riskeer.Integration.Plugin/Merge/AssessmentSectionMergeHandler.cs (.../AssessmentSectionMergeHandler.cs) (revision 8611667bb3db61470828f71f5bb80a0fd892278e) @@ -298,7 +298,7 @@ if (mergeData.MergeClosingStructures) { targetAssessmentSection.ClosingStructures = sourceAssessmentSection.ClosingStructures; - UpdateCalculationHydraulicBoundaryLocationReferences, ClosingStructuresInput>( + UpdateCalculationHydraulicBoundaryLocationReferences, ClosingStructuresInput>( targetAssessmentSection.ClosingStructures, hydraulicBoundaryLocations); LogMergeMessage(targetAssessmentSection.ClosingStructures); } Index: Riskeer/Integration/test/Riskeer.Integration.Plugin.Test/Merge/AssessmentSectionMergeHandlerTest.cs =================================================================== diff -u -r079e42bc128e70aa23afb417b1dea7a0b522579f -r8611667bb3db61470828f71f5bb80a0fd892278e --- Riskeer/Integration/test/Riskeer.Integration.Plugin.Test/Merge/AssessmentSectionMergeHandlerTest.cs (.../AssessmentSectionMergeHandlerTest.cs) (revision 079e42bc128e70aa23afb417b1dea7a0b522579f) +++ Riskeer/Integration/test/Riskeer.Integration.Plugin.Test/Merge/AssessmentSectionMergeHandlerTest.cs (.../AssessmentSectionMergeHandlerTest.cs) (revision 8611667bb3db61470828f71f5bb80a0fd892278e) @@ -56,10 +56,10 @@ public void Constructor_ViewCommandsNull_ThrowsArgumentNullException() { // Call - TestDelegate call = () => new AssessmentSectionMergeHandler(null); + void Call() => new AssessmentSectionMergeHandler(null); // Assert - var exception = Assert.Throws(call); + var exception = Assert.Throws(Call); Assert.AreEqual("viewCommands", exception.ParamName); } @@ -90,12 +90,11 @@ var handler = new AssessmentSectionMergeHandler(viewCommands); // Call - TestDelegate call = () => handler.PerformMerge(null, new AssessmentSectionMergeData( - new AssessmentSection(AssessmentSectionComposition.Dike), - new AssessmentSectionMergeData.ConstructionProperties())); + void Call() => handler.PerformMerge(null, new AssessmentSectionMergeData(new AssessmentSection(AssessmentSectionComposition.Dike), + new AssessmentSectionMergeData.ConstructionProperties())); // Assert - var exception = Assert.Throws(call); + var exception = Assert.Throws(Call); Assert.AreEqual("targetAssessmentSection", exception.ParamName); mocks.VerifyAll(); } @@ -111,10 +110,10 @@ var handler = new AssessmentSectionMergeHandler(viewCommands); // Call - TestDelegate call = () => handler.PerformMerge(new AssessmentSection(AssessmentSectionComposition.Dike), null); + void Call() => handler.PerformMerge(new AssessmentSection(AssessmentSectionComposition.Dike), null); // Assert - var exception = Assert.Throws(call); + var exception = Assert.Throws(Call); Assert.AreEqual("mergeData", exception.ParamName); } @@ -412,7 +411,7 @@ HydraulicBoundaryLocation = sourceLocations[1] } }); - sourceAssessmentSection.ClosingStructures.CalculationsGroup.Children.Add(new StructuresCalculation + sourceAssessmentSection.ClosingStructures.CalculationsGroup.Children.Add(new StructuresCalculationScenario { InputParameters = { @@ -476,7 +475,7 @@ var pipingCalculation = (PipingCalculationScenario) targetAssessmentSection.Piping.Calculations.Single(); Assert.AreSame(targetLocations[0], pipingCalculation.InputParameters.HydraulicBoundaryLocation); - var grassInwardsCalculation = (GrassCoverErosionInwardsCalculation) targetAssessmentSection.GrassCoverErosionInwards.Calculations.Single(); + var grassInwardsCalculation = (GrassCoverErosionInwardsCalculationScenario) targetAssessmentSection.GrassCoverErosionInwards.Calculations.Single(); Assert.AreSame(targetLocations[1], grassInwardsCalculation.InputParameters.HydraulicBoundaryLocation); var macroStabilityInwardsCalculation = (MacroStabilityInwardsCalculation) targetAssessmentSection.MacroStabilityInwards.Calculations.Single(); @@ -485,7 +484,7 @@ var heightStructuresCalculation = (StructuresCalculation) targetAssessmentSection.HeightStructures.Calculations.Single(); Assert.AreSame(targetLocations[1], heightStructuresCalculation.InputParameters.HydraulicBoundaryLocation); - var closingStructuresCalculation = (StructuresCalculation) targetAssessmentSection.ClosingStructures.Calculations.Single(); + var closingStructuresCalculation = (StructuresCalculationScenario) targetAssessmentSection.ClosingStructures.Calculations.Single(); Assert.AreSame(targetLocations[0], closingStructuresCalculation.InputParameters.HydraulicBoundaryLocation); var stabilityPointStructuresCalculation = (StructuresCalculation) targetAssessmentSection.StabilityPointStructures.Calculations.Single();