Index: Ringtoets/DuneErosion/src/Ringtoets.DuneErosion.Service/DuneErosionDataSynchronizationService.cs
===================================================================
diff -u -r446331426de42bdbfe335cab941bd2bb32292340 -rbc8aa3634aa6fb9e673c60c230844ea8827affb2
--- Ringtoets/DuneErosion/src/Ringtoets.DuneErosion.Service/DuneErosionDataSynchronizationService.cs (.../DuneErosionDataSynchronizationService.cs) (revision 446331426de42bdbfe335cab941bd2bb32292340)
+++ Ringtoets/DuneErosion/src/Ringtoets.DuneErosion.Service/DuneErosionDataSynchronizationService.cs (.../DuneErosionDataSynchronizationService.cs) (revision bc8aa3634aa6fb9e673c60c230844ea8827affb2)
@@ -101,23 +101,6 @@
}
///
- /// Clears the output of the dune locations within the collection.
- ///
- /// The locations for which the output needs to be cleared.
- /// All objects changed during the clear.
- /// Thrown when is null.
- public static IEnumerable ClearDuneLocationOutput(IEnumerable locations)
- {
- if (locations == null)
- {
- throw new ArgumentNullException(nameof(locations));
- }
-
- return locations.SelectMany(ClearDuneLocationOutput)
- .ToArray();
- }
-
- ///
/// Clears the output of the dune location calculations within the dune erosion failure mechanism.
///
/// The failure mechanism for which the output of the calculations needs to be cleared.
@@ -132,18 +115,19 @@
var affectedCalculations = new List();
- affectedCalculations.AddRange(ClearDuneCalculationsOutput(failureMechanism.CalculationsForMechanismSpecificFactorizedSignalingNorm));
- affectedCalculations.AddRange(ClearDuneCalculationsOutput(failureMechanism.CalculationsForMechanismSpecificSignalingNorm));
- affectedCalculations.AddRange(ClearDuneCalculationsOutput(failureMechanism.CalculationsForMechanismSpecificLowerLimitNorm));
- affectedCalculations.AddRange(ClearDuneCalculationsOutput(failureMechanism.CalculationsForLowerLimitNorm));
- affectedCalculations.AddRange(ClearDuneCalculationsOutput(failureMechanism.CalculationsForFactorizedLowerLimitNorm));
+ affectedCalculations.AddRange(ClearDuneLocationCalculationsOutput(failureMechanism.CalculationsForMechanismSpecificFactorizedSignalingNorm));
+ affectedCalculations.AddRange(ClearDuneLocationCalculationsOutput(failureMechanism.CalculationsForMechanismSpecificSignalingNorm));
+ affectedCalculations.AddRange(ClearDuneLocationCalculationsOutput(failureMechanism.CalculationsForMechanismSpecificLowerLimitNorm));
+ affectedCalculations.AddRange(ClearDuneLocationCalculationsOutput(failureMechanism.CalculationsForLowerLimitNorm));
+ affectedCalculations.AddRange(ClearDuneLocationCalculationsOutput(failureMechanism.CalculationsForFactorizedLowerLimitNorm));
return affectedCalculations;
}
- private static IEnumerable ClearDuneCalculationsOutput(IEnumerable calculations)
+ private static IEnumerable ClearDuneLocationCalculationsOutput(IEnumerable calculations)
{
IEnumerable affectedCalculations = calculations.Where(c => c.Output != null).ToArray();
+
affectedCalculations.ForEachElementDo(c => c.Output = null);
return affectedCalculations;
@@ -175,14 +159,5 @@
return match.Groups["Offset"].Value == duneLocationOffset;
}
-
- private static IEnumerable ClearDuneLocationOutput(DuneLocation location)
- {
- if (location.Calculation.Output != null)
- {
- location.Calculation.Output = null;
- yield return location;
- }
- }
}
}
\ No newline at end of file
Index: Ringtoets/DuneErosion/test/Ringtoets.DuneErosion.Service.Test/DuneErosionDataSynchronizationServiceTest.cs
===================================================================
diff -u -r1878cb65b082e46d7e9c74e849d79980b46d3af9 -rbc8aa3634aa6fb9e673c60c230844ea8827affb2
--- Ringtoets/DuneErosion/test/Ringtoets.DuneErosion.Service.Test/DuneErosionDataSynchronizationServiceTest.cs (.../DuneErosionDataSynchronizationServiceTest.cs) (revision 1878cb65b082e46d7e9c74e849d79980b46d3af9)
+++ Ringtoets/DuneErosion/test/Ringtoets.DuneErosion.Service.Test/DuneErosionDataSynchronizationServiceTest.cs (.../DuneErosionDataSynchronizationServiceTest.cs) (revision bc8aa3634aa6fb9e673c60c230844ea8827affb2)
@@ -80,7 +80,7 @@
}
[Test]
- public void SetDuneLocations_ReadDuneLocationsNull_ThrowArgumentNullException()
+ public void SetDuneLocations_DuneLocationsNull_ThrowArgumentNullException()
{
// Setup
var failureMechanism = new DuneErosionFailureMechanism();
@@ -114,7 +114,7 @@
duneLocation
}, failureMechanism.DuneLocations);
- // call
+ // Call
DuneErosionDataSynchronizationService.SetDuneLocations(failureMechanism,
new HydraulicBoundaryLocation[0],
new ReadDuneLocation[0]);
@@ -163,7 +163,7 @@
[TestCase(-0.123)]
[TestCase(1)]
[TestCase(123.456789)]
- public void SetDuneLocations_DuneLocationsMatchNameNotAccordingFormat_DeuneLocationNotAddedLogMessage(double offset)
+ public void SetDuneLocations_DuneLocationsMatchNameNotAccordingFormat_DuneLocationNotAddedLogMessage(double offset)
{
// Setup
string locationName = $"Location_{offset}";
@@ -218,45 +218,6 @@
}
[Test]
- public void ClearDuneLocationOutput_LocationsNull_ThrowArgumentNullException()
- {
- // Call
- TestDelegate test = () => DuneErosionDataSynchronizationService.ClearDuneLocationOutput(null);
-
- // Assert
- var exception = Assert.Throws(test);
- Assert.AreEqual("locations", exception.ParamName);
- }
-
- [Test]
- public void ClearDuneLocationOutput_LocationWithOutput_OutputClearedAndAffectedItemReturned()
- {
- // Setup
- var location = new TestDuneLocation
- {
- Calculation =
- {
- Output = new TestDuneLocationCalculationOutput()
- }
- };
-
- // Call
- IEnumerable affected = DuneErosionDataSynchronizationService.ClearDuneLocationOutput(
- new []
- {
- location
- });
-
- // Assert
- Assert.IsNull(location.Calculation.Output);
- CollectionAssert.AreEqual(
- new[]
- {
- location
- }, affected);
- }
-
- [Test]
public void ClearDuneLocationCalculationOutput_FailureMechanismNull_ThrowsArgumentNullException()
{
// Call